def simulate(k): buy = 0 s = 0, 0 for _ in range(k): if s[1] == INF: break if s[1] == 0: buy += 1 s = f(s) return buy def f(s): p, t = s np = (p+1) % N if 0 < memo[p] <= t or memo[p] == INF: memo[p] = INF return np, INF nt = t + ds[p] if t > 0: nt -= 1 memo[p] = nt return np, nt INF = 1 << 60 N, K = map(int, input().split()) S = input() memo = [0] * N ds = [int(c) for c in S] res = simulate(K) print(res)