n,k = gets.split(" ").map(&:to_i)
s = gets.chomp.each_char.map { |c| c == '1' } 

#p s
max = 0
n.times do |i|
    break if n-i <= max
    
    count = 0
    mode = false #反転範囲内のときtrue
    _k = k
    _i = i

    loop do
        break if _i >= n
        if s[_i]
            mode = false
        else
            unless mode
                mode = true
                _k -= 1
            end
        end

        break if _k<0
        _i += 1
    end
    

    count = _i - i
    #puts [i,count].join(" ")
    if count>max
        max = count
    end
end

puts max
