* Line 1: Two space-separated integers, the first giving the number of
cyclic shifts and the second giving the number cows involved
in the longest such shift. If there are no cyclic shifts,
output -1 for the second number.
There are two cyclic shifts, one involving cows 5, 1, and 2, and the other
involving cows 3 and 4.