Finding the smallest sequence of numbers that repeat

I want to find the smallest sequence of numbers that are repeated in a given array.

Example: 1, 2, -2, 1, 2, -2, 1, 2, should output 3 because "1, 2, -2" is repeated

Example 2: 1, 2, 1, should output 2 because "1, 2" is repeated