### BUGGY CODE ###

from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


# globals
inf = float('inf')
N, K = 0, 0
S = ""


def set_inputs():
    global N, K, S
    N, K = get_li()
    S = get_str()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    cont = []
    cur = S[0]
    count = 1
    for s in S[1:]:
        if cur == s:
            count += 1
        else:
            cont.append((count, cur))
            cur = s
            count = 1
    cont.append((count, cur))
    
    if len(cont) == 1:
        print(len(S))
        return
    ans = 0
    for i in range(len(cont)):
        if cont[i][1] == "0":
            ans = max(ans, sum(map(operator.itemgetter(0), cont[i:i+2*K])))
        else:
            ans = max(ans, sum(map(operator.itemgetter(0), cont[i:i+2*K+1])))
    print(ans)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()


### FIXED CODE ###

from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


# globals
inf = float('inf')
N, K = 0, 0
S = ""
M = 300000


def set_inputs():
    global N, K, S
    N, K = get_li()
    S = get_str()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    cont = []
    cur = S[0]
    count = 1
    for s in S[1:]:
        if cur == s:
            count += 1
        else:
            cont.append((count, cur == "1"))
            cur = s
            count = 1
    cont.append((count, cur == "1"))
    
    lc = len(cont)
    if lc == 1:
        print(len(S))
        return
    cont = cont + ([(0, None)] * M)
    if cont[0][1] == False:
        cont = [(0, None)] + cont
    ans = 0
    tmp = sum(map(operator.itemgetter(0), cont[:2*K+1]))
    ans = tmp
    i = 2
    while i < lc + 1:
        tmp = tmp - cont[i-2][0] - cont[i-1][0] + cont[i+2*K-1][0] + cont[i+2*K][0]
        ans = max(ans, tmp)
        i += 2
    print(ans)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()