import sequtils,strutils,math var N, K : int (N, K) = stdin.readline.split.map(parseInt) proc ctoi(c : char):int = return c.int - '0'.int var S = stdin.readline cnt : array[2,int] cnta : int ans : int cnt2 : array[51,int] for i in 0..1: for j,s in S: if cnta == 0: cnt[i] += 1 else: cnta -= 1 if (i == 1 and N < K) or (i == 0 and N >= K): cnt2[j + 1] = cnt[i] cnta += s.ctoi if cnt[0] == cnt[1] or K <= N: ans = K div N * cnt[0] + cnt2[K mod N] else: ans = cnt[0] + (K div N - 1) * cnt[1] + cnt2[K mod N] echo ans