N,K=map(int,input().split()) A=list(map(int,input().split())) B=[-1]*N res=K for i in range(N): mod=A[i]+1-i if mod<=0: for j in range(i,N): B[j]=A[j] break pos=(-res)%mod cur=0 for j in range(N): if B[j]!=-1: continue if cur==pos: B[j]=A[i] break else: cur+=1 res-=(res+mod-1)//mod print(*B)