N,K=map(int,input().split()) S=list(map(int,list(input().strip()))) SUM=[0] for s in S: SUM.append(SUM[-1]+s) if N<=SUM[-1]: OK=N else: OK=K def calc(x): ANS=(x//N)*SUM[-1] if x%N>0: ANS+=SUM[(x%N)] return ANS NG=0 while OK>NG+1: #print(OK,NG) mid=(OK+NG)//2 NOW=0 PLUS=mid while True: #print(NOW,PLUS) k=calc(PLUS)-calc(NOW) NOW=PLUS PLUS=PLUS+k if PLUS>=K or PLUS>=mid+2*N: break if PLUS==NOW: break #print(mid,NOW,PLUS) if PLUS>=K or PLUS>=mid+2*N: OK=mid else: NG=mid print(OK)