I have an array y, len(y) = M that contains values from 0 -> N. For example, with N = 3:
y, len(y) = M
0 -> N
N = 3
y = [0, 2, 0, 1, 2, 1, 0, 2