k = k%len is the key point