def solve(): N, K = list(map(int, input().split())) S = list(map(int, input())) ans = 0 x1 = 0 y1 = 0 b1, b2 = divmod(K, N) if b1 > 0: for i in range(N): if y1 == 0: x1 += 1 else: y1 -= 1 y1 += S[i] x2 = max(x1 - y1, 0) ans += x1 b1 -= 1 ans += b1 * x2 x3 = 0 y3 = y1 for i in range(b2): if y3 == 0: x3 += 1 else: y3 -= 1 y3 += S[i] ans += x3 print(ans) if __name__ == '__main__': solve()