import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] def main(): n,k=MI() pp=LI() maxlv=k.bit_length()+1 to=[[-1]*n for _ in range(maxlv+1)] dist=[[-1]*n for _ in range(maxlv+1)] for u in range(n): v=(u+pp[u])%n to[0][u]=v dist[0][u]=pp[u] tolv=to[0] dlv=dist[0] for lv in range(maxlv): tolv1=to[lv+1] dlv1=dist[lv+1] for u in range(n): v=tolv[u] tolv1[u]=tolv[v] dlv1[u]=dlv[u]+dlv[v] tolv=tolv1 dlv=dlv1 uu=list(range(n)) ans=list(range(1,n+1)) lv=0 while k: if k&1: tolv=to[lv] dlv=dist[lv] for i in range(n): u=uu[i] uu[i]=tolv[u] ans[i]+=dlv[u] k>>=1 lv+=1 print(*ans,sep="\n") main()