import sys input = sys.stdin.readline N, K = map(int, input().split()) P = list(map(int, input().split())) dp = [[-1]*N for _ in range(31)] for i in range(N): dp[0][i] = P[i] for i in range(1, 31): for j in range(N): dp[i][j] = dp[i-1][j]+dp[i-1][(j+dp[i-1][j])%N] for i in range(N): k = K now = i for j in range(31): if k&1: now += dp[j][now%N] k >>= 1 print(now+1)