def main0(n,k,s): cnt=0 ans=0 atari=0 while cnt=ans:return ans d={} cnt=0 ans=0 atari=0 while True: for i in range(n): x=s[i] if atari: atari-=1 else: ans+=1 atari+=x cnt+=1 if cnt==k:return ans if (i,atari) in d: cnt0,ans0=d[(i,atari)] dcnt=cnt-cnt0 dans=ans-ans0 loopcnt=(k-cnt)//dcnt ans+=loopcnt*dans cnt+=loopcnt*dcnt else: d[(i,atari)]=cnt,ans if __name__=='__main__': n,k=map(int,input().split()) s=list(map(int,list(input()))) #ret0=main0(n,k,s) ret1=main1(n,k,s) print(ret1) #print(ret0,ret1)