Harryxun/stf_run huggingface dataset:
import bisect

N,K = map(int,input().split())
N = [int(n) for n in str(N)]
D = set(map(int,input().split()))
nums = []
for i in range(10):
  if i not in D:nums.append(i)
nums.sort()

if len(nums) == 0:
  print(N)
  exit()

i = len(N)-1
while i>=0:
  if N[i] not in nums:
    if nums[-1] < N[i]:
      prv_len = len(N)
      tmp_N = [int(s) for s in str(int(''.join([str(n) for n in N[:i]])) + 1)]
      N = tmp_N + [nums[0]]
      if len(N) > prv_len: i += 1
    else:
      j = bisect.bisect(nums,N[i])        
      N[i] = nums[j]
  i -= 1
print(''.join([str(n) for n in N]))

### FIXED CODE ###

import bisect

N,K = map(int,input().split())
N = [int(n) for n in str(N)]
D = set(map(int,input().split()))
nums = []
for i in range(10):
  if i not in D:nums.append(i)
nums.sort()

i = len(N)-1
while i>=0:
  if N[i] not in nums:
    if nums[-1] < N[i]:
      prv_len = len(N)
      tmp_N = [int(s) for s in str(int(''.join([str(n) for n in N[:i]])) + 1)] if len(N[:i])>0 else [1]
      N = tmp_N + [nums[0] for _ in range(prv_len-i)]
      if len(N) > prv_len: i += 1
    else:
      j = bisect.bisect(nums,N[i])
      N[i:] = [nums[j]] + [nums[0] for _ in range(len(N)-i-1)]
  #print(i,N)
  i -= 1
print(''.join([str(n) for n in N]))
#print(N)
temp = input()
if temp >= 30:
    print("Yes")

else:
    print("No")

### FIXED CODE ###

temp = int(input())
if temp >= 30:
    print("Yes")

else:
    print("No")
one = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}
n=int(input())
for i in range(n):
  one[input()[0]] += 1
m,a,r,c,h=one['M'],one['A'],one['R'],one['C'],one['H']
print(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h)

### FIXED CODE ###

one = {'M':0, 'A':0, 'R':0, 'C':0, 'H':0}
n=int(input())
for i in range(n):
  c=input()[0]
  one[c] = one.get(c,0)+1
m,a,r,c,h=one['M'],one['A'],one['R'],one['C'],one['H']
print(m*a*r+m*a*c+m*a*h+m*r*c+m*r*h+m*c*h+a*r*c+a*r*h+a*c*h+r*c*h)
N = float(input())
EBTC = 380000.0
R = 0
for i in range(N):
    t = [x for x in input().split()]
    R = R + float(t[0]) if t[1]=="JPY" else R + float(t[0])*EBTC
print(int(R))

### FIXED CODE ###

N = int(input())
EBTC = 380000.0
R = 0
for i in range(N):
    t = [x for x in input().split()]
    R = R + float(t[0]) if t[1]=="JPY" else R + float(t[0])*EBTC
print(R)
import itertools
import heapq
import sys
import functools
import operator
import numpy as np
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
a.sort(reverse = True)
w = 10**9 + 7
ans = 1
if k%2 == 1:
  for i in range(k):
    ans *= a[i]
    print(ans % w)

else:
  if n%2 == 0:
    a_new = [a[2*i]*a[2*i+1] for i in range(n//2)]
    a_new.sort(reverse = True)
    print(a_new)
    for j in range(k//2):
      ans *= a_new[j]
      print(ans % w)
      
  else:
    a_plus = heapq.nlargest(k, a)
    a_minus = heapq.nsmallest(k, a)
    a_plus.sort(reverse = True)
    a_minus.sort()
    a_plus_new = [a_plus[2*i]*a_plus[2*i+1] for i in range(len(a_plus))]
    a_minus_new = [a_minus[2*i]*a_minus[2*i+1] for i in range(len(a_minus))]
    a_new = a_plus_new + a_minus_new
    a_new.sort(revserse = True)
    for j in range(k//2):
      ans *= a_new[j]
      print(ans % w)

### FIXED CODE ###

a = int(input())
 
mod = a % 1000

if mod == 0:
  print(0)
else:
  b = mod -1000
  c = int(abs(b))
 
  print(c)
N, K = map(int, input().split())
price = [int(input()) for _ in range(N)]
price.sort()
print(sum(price[:3]))

### FIXED CODE ###

N, K = map(int, input().split())
price = list(map(int, input().split()))
price.sort()
print(sum(price[:K]))
def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_
    
def gcd_(a, b):
    if a < b:  a, b = b, a
    if b == 0:  return a
    return gcd_(b, a % b)

def gcd(l):
    ans = l[0]
    for i in l:  ans = gcd_(ans, i)
    return ans

def gcd_bl(A):

    left = [0 for _ in range(N + 1)]
    right = [0 for _ in range(N + 1)]
    ans = [0 for _ in range(N)]

    left[1] = A[0]
    for i in range(1, N):
        left[i + 1] = gcd_(left[i], A[i])
    right[-1 - 1] = A[-1]
    for i in range(1, N):
        right[-1 - i - 1] = gcd_(right[-1 - i], A[-1 - i])

    for i in range(N):
        ans[i] = gcd_(left[i], right[N - i - 2])
        
    return ans

def solve():
    
    g = gcd_bl(A)

    for i in range(N):
        if A[i] == K:  return 1
        elif A[i] > K:
            temp = (K - A[i]) / g[i]
            if temp == int(temp):
                return 1

    return 0

N, K = cin()
A = cin()

ret = solve()
if ret:  print("POSSIBLE")
else:  print("IMPOSSIBLE")

### FIXED CODE ###

def gcd_(a, b):
    if a < b:  a, b = b, a
    if b == 0:  return a
    return gcd_(b, a % b)

def gcd_bl(A):

    left = [0 for _ in range(N + 1)]
    right = [0 for _ in range(N + 1)]
    ans = [0 for _ in range(N)]

    left[1] = A[0]
    for i in range(1, N):  left[i + 1] = gcd_(left[i], A[i])
    right[-1 - 1] = A[-1]
    for i in range(1, N):  right[-1 - i - 1] = gcd_(right[-1 - i], A[-1 - i])
    for i in range(N):  ans[i] = gcd_(left[i], right[i + 1])
        
    return ans

def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

def solve():   
    if N == 1:  return A == K    
    g = gcd_bl(A)
    for i in range(N):
        if A[i] == K:  return 1
        elif A[i] > K:
            temp = (K - A[i]) / g[i]
            if temp == int(temp):  return 1
    return 0

N, K = cin()
A = cin()
ret = solve()
if ret:  print("POSSIBLE")
else:  print("IMPOSSIBLE")
a=int(input())
b=int(input())
if(a>=10):
    print(-1)
elif(b>=10):
    print(-1)
else:
    print(a*b)
    
#print(a+1)
#print(b+1)

### FIXED CODE ###

a,b=map(int,input().split())
if(a>=10):
    print(-1)
elif(b>=10):
    print(-1)
else:
    print(a*b)
c=input()
list=[a,i,u,o,e]
if c in list:
  print("vowel")
else:
  print("consonant")

### FIXED CODE ###

c=str(input())
list=["a","i","u","o","e"]
if c in list:
  print("vowel")
else:
  print("consonant")
N = int(input())
v = [int(e) for e in input().split()]

a = sorted(v, reversed = True) #昇順に並べる
result = a[0]
for i in range(N - 1):
    result += (result + a[i]) / 2
print(result)

### FIXED CODE ###

N = int(input())
v = [int(e) for e in input().split()]

v.sort() #昇順に並べる
result = v[0]
for i in range(1, N):
    result = (result + v[i]) / 2
print(result)
word = map(str, input())

if word[2]==word[3] and word[4]==word[5]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

word = str(input())
 
if word[2]==word[3] and word[4]==word[5]:
  print('Yes')
else:
  print('No')
print(x ** 3)



### FIXED CODE ###

input_str = input()
input_int = int(input_str)
print(input_int ** 3)
n,d = map(int,input(),split(" "))
d *= d
c = 0
for i in range(n):
  a,b =map(int,input().split(" "))
  if(a**2 + b**2 == d):
    c += 1
print(c)

### FIXED CODE ###

n,d = map(int,input().split(" "))
d *= d
c = 0
for i in range(n):
  a,b =map(int,input().split(" "))
  if(a**2 + b**2 <= d):
    c += 1
print(c)
n, m = list(map(int, input().split()))

item_votes = list(map(int, input().split()))

total_item_votes = sum(item_votes)

item_vote_percentages = [item_votes/total_item_votes for item_votes in item_votes]

required_vote_percentage = 1/(4*m)

can_select = 0
for vote_percentage in item_vote_percentages:
  if vote_percentage > required_vote_percentage:
    can_select += 1

    if can_select >= m:
      print('Yes')
      else:
        print('No')

### FIXED CODE ###

# number of items, number of popular items to select
n, m = list(map(int, input().split()))

item_votes = list(map(int, input().split()))

total_item_votes = sum(item_votes)

item_vote_percentages = [item_votes/total_item_votes for item_votes in item_votes]

required_vote_percentage = 1/(4*m)

can_select = 0
for vote_percentage in item_vote_percentages:
    if vote_percentage >= required_vote_percentage:
        can_select += 1

if can_select >= m:
    print('Yes')
else:
    print('No')
from sys import stdin
n,m = int(stdin.readline().split())
ans = 1
x = 1
a = []
while x * x <=m:
 if m%x==0:
  a.append(x)
  a.append(m/x)
 x+=1
for i in a:
 if m/i <= n:
  ans = max(ans,i)
print ans

### FIXED CODE ###

from sys import stdin
n,m = map(int,stdin.readline().split())
ans = 1
x = 1
a = []
while x * x <=m:
 if m%x==0:
  a.append(x)
  a.append(m/x)
 x+=1
for i in a:
 if m/i >= n:
  ans = max(ans,i)
print ans
from itertools import combinations
L, R = map(int, input().split())
ans = 2018
for i, j in combinations(range(L, R + 1), 2):
    a = i % 2019
    b = j % 2019
    mod = (a * b) % 2019
    if ans > mod:
        ans = mod
print(ans)


### FIXED CODE ###

from itertools import combinations
L, R = map(int, input().split())
if (L % 2019 > R % 2019) or R - L >=2019:
    print(0)
else:
    ans = 2018
    for i, j in combinations(range(L, R + 1), 2):
        a = i % 2019
        b = j % 2019
        mod = (a * b) % 2019
        if ans > mod:
            ans = mod
    print(ans)
while True:
  inl=map(int, raw_input().split())
  num=inl[0]+inl[1]
  a=list(str(num))

  time=0
  for i in a:
    time+=1

  print time

### FIXED CODE ###

import sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num=int(inl[0])+int(inl[1])
    l=list(str(num))
    time=0
    for i in l:
        time+=1
    print time
n,k = list(map(int,input().split()))

a = list(map(int,input().split()))

middle = -(-(max(a) / 2) // 1)
oldMiddle = 0
h = middle // 2
rightMin = max(a)

while h > 0:
    cut = 0
    for i in range(n):
        cut += -(-((a[i] / middle) - 1) // 1)
    h = -(-(abs(middle - oldMiddle) / 2) // 1)
    oldMiddle = middle
    if cut <= k:
        if (middle - h == rightMin):
            break
        middle -= h
    else:
        rightMin = middle
        middle += h

print(int(middle))

### FIXED CODE ###

import math

n,k = list(map(int,input().split()))

a = list(map(int,input().split()))

middle = math.ceil(max(a) / 2)
oldMiddle = 0
h = middle // 2
rightMin = max(a)

while h > 0:
    cut = 0
    if middle == 0:
        middle = 1
        break
    for i in range(n):
        cut += math.ceil(a[i] / middle) - 1
    h = math.ceil(abs(middle - oldMiddle) / 2)
    oldMiddle = middle
    if cut <= k:
        if (middle - h == rightMin):
            break
        middle -= h
    else:
        rightMin = middle
        middle += h

print(middle)
import itertools
import numpy as np
from scipy.special import comb

mod = 998244353

N,M,K = map(int, input().split())

# DP = [[0]*N for _ in range(N)]
# DP[0][0] = M

# DP = []


# for n in range(1,N):
# 	for k in range(N):
# 		if k==0:
# 			DP[n][k] = DP[n-1][k]*(M-1) % mod
# 		else:
# 			DP[n][k] = (DP[n-1][k]*(M-1) + DP[n][k-1]) % mod

# ans = sum(DP[N-1][:(K+1)]) % mod
# print(ans)

ans = 0
for k in range(K+1):
	ans += comb(N, k)*(M-1)**(N-k-1) % mod

print(int(ans*M) % mod)

### FIXED CODE ###

MOD = 998244353
MAX = 510000
fac = [1,1] # factorial
finv = [1,1] # inverse of factorial
inv = [None, 1] # inverse

def comb_init():
	for i in range(2, MAX):
		fac.append(fac[i-1] * i % MOD)
		inv.append(MOD - inv[MOD % i] * (MOD//i) % MOD)
		finv.append(finv[i-1] * inv[i] % MOD)

def inverse_mod(a):
	""" Calculate inverse of the integer in a modulo MOD """
	return pow(a, MOD-2, MOD)

def comb_mod(n, r):
	""" Calculate nCr modulo MOD. """
	if n < r: return 0
	if n < 0 or r < 0: return 0
	return fac[n]* (finv[r]*finv[n-r] % MOD) % MOD

def solve(n, m, k):
	ans = 0
	for k in range(K+1):
		ans = (ans + m*(comb_mod(n-1,k)*pow(m-1, n-k-1, MOD) % MOD) % MOD) % MOD
	return ans

comb_init()
N, M, K = map(int, input().split())
print(solve(N, M, K))
N,K = map(int,input().split())
if K == 1:
    print(1)
else:
    for i in range(1,K+1):
        if i == 1 or i == K:
            print(comb(N-K+1,i,10**9+7))
        else:
            k = factorial(N-K+1) % (10**9+7)
            l = factorial(N-K+1-i) % (10**9+7)
            m = factorial(i-1) % (10**9+7)
            #print(k,l,m)
            print( (k//(l*m)))
            #print( (k//(l*m)))
            #print(comb(N-K+1,i,10**9+7))

### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7
MAX = 4000
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range( 2, MAX + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
n,k= map(int,input().split())
for i in range(1,k+1):
    pre = cmb(k-1,i-1,mod)
    pos = cmb(n-k+1,i,mod)
    print((pre*pos)%mod)
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N,K = inputMap()
	sushi_mi = []
	sushi_ki = []
	syu = {}
	for i in range(N):
		t,d = inputMap()
		if t in syu:
			sushi_ki.append(d)
		else:
			syu[t] = 1
			sushi_mi.append(d)

	sushi_mi.sort()
	sushi_mi = sushi_mi[::-1]
	sushi_ki.sort()
	sushi_ki = sushi_ki[::-1]

	ans = 0
	for i in range(1,K+1):
		tmp = 0
		for j in range(0,i):
			tmp += sushi_mi[j]
		for j in range(0,K-i):
			tmp += sushi_ki[j]

		tmp += i*i
		if tmp > ans:
			ans = tmp

	print(ans)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N,K = inputMap()
	sushi_mii = []
	sushi_kii = []
	syu = [[] for i in range(N)]
	for i in range(N):
		t,d = inputMap()
		t -= 1
		syu[t].append(d)

	for i in syu:
		if len(i) > 0:
			i.sort()
			i = i[::-1]
			for j,val in enumerate(i):
				if j == 0:
					sushi_mii.append(val)
				else:
					sushi_kii.append(val)

	sushi_mii.sort()
	sushi_mii = sushi_mii[::-1]
	sushi_kii.sort()
	sushi_kii = sushi_kii[::-1]

	sushi_mi = []
	sushi_ki = []
	for i,val in enumerate(sushi_mii):
		if i == 0:
			sushi_mi.append(val)
		else:
			tmp = sushi_mi[i-1]
			sushi_mi.append(tmp + val)

	for i,val in enumerate(sushi_kii):
		if i == 0:
			sushi_ki.append(val)
		else:
			tmp = sushi_ki[i-1]
			sushi_ki.append(tmp + val)

	ans = 0
	for i in range(1, min(len(sushi_mi), K)+1):
		x = 0
		tmp = 0
		if K - i > len(sushi_ki):
			continue

		tmp += sushi_mi[i-1]
		x = i

		if K - i > 0:
			tmp += sushi_ki[K - i-1]

		oishi = tmp + x * x
		if ans < oishi:
			ans = oishi
	print(ans)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()
a,b = map(int, input().split())
if a == 1:
  if b == 1:
    print("Draw")
    exit()
  else:
  	print("Alice")
    exit()
else:
  if a == b:
    print("Draw")
    exit()
  elif a > b:
    print("Alice")
    exit()
  else:
    print("Bob")
    exit()

### FIXED CODE ###

a,b = map(int, input().split())
if a == 1:
    if b == 1:
        print("Draw")
    else:
        print("Alice")
else:
    if a == b:
        print("Draw")
    elif b == 1:
        print("Bob")
    elif a > b:
        print("Alice")
    else:
        print("Bob")
def cur(x):

    if len(x)<m+1:
        ans=0
        for i in range(x[-1],m+1):
            ans=max(ans,cur(x+[i]))
    else:
        ans=0
        for i in range(q):
            [a,b,c,d]=l[i]
            if x[b]-x[a]==c: ans+=d
    return ans

n,m,q=map(int,input().split())
l=[list(map(int,input().split())) for i in range(q)]
print(cur([1]))

### FIXED CODE ###

def cur(x):

    if len(x)<n+1:
        ans=0
        for i in range(x[-1],m+1):
            ans=max(ans,cur(x+[i]))
    else:
        ans=0
        for i in range(q):
            [a,b,c,d]=l[i]
            if x[b]-x[a]==c: ans+=d
    return ans

n,m,q=map(int,input().split())
l=[list(map(int,input().split())) for i in range(q)]
print(cur([1]))
n,m = map(int,input().split())
a_list = []
for i in range(m):
    a_list.append(int(input()))
    
mod = 1000000007

dp = [0]*n
dp[0] = 1
if 1 in a_list:
    dp[0] = 0
    
dp[1] = 1 + dp[0]
if 2 in a_list:
    dp[1] = 0
for i in range(2,n):
    if (i+1) in a_list:
        continue
    else:
        dp[i] = dp[i-1] + dp[i-2]
        dp[i] %= mod
print(dp[-1])

### FIXED CODE ###

n,m = map(int,input().split())
dp = [0]*n

for i in range(m):
    dp[int(input())-1] = 10**12
    
if dp[0] == 10**12:
    dp[0] = 0
else:
    dp[0] = 1

if n == 1:
    print(dp[0])
else:
    if dp[1] == 10**12:
        dp[1] = 0
    else:
        dp[1] = 1+ dp[0]

    mod = 1000000007

    for i in range(2,n):
        if dp[i] == 10**12:
            dp[i] = 0
        else:
            dp[i] = dp[i-1] + dp[i-2]
            dp[i] %= mod
    print(dp[-1])
a, b = map(int, input().split())
c, d = map(int, input().split())
if (a*b)==(c*d):
 print((a*b)-(c*d))
else if (a*b) > (c*d):
 print((c*d))

### FIXED CODE ###

a, b = map(int, input().split())
c, d = map(int, input().split())
print((a-c)*(b-d))
n = input()
l = list(map(int,input().split(" ")))

count = 0

while True:
  for i in range(n):
    if l[i]%2 == 0:
      l[i]//2
    else:
      print(count)
      break
  count += 1

  
  

### FIXED CODE ###

n = int(input())
l=list(map(int,input().split()))
count=0
while True:
    for i in range(n):
        if l[i]%2==0:
            l[i]=l[i]//2
        else:
            print(count)
            exit()
    count+=1
import itertools
 
n, m = list(map(int, input().split(" ")))
l = [ i for i in range(n + 1) ]
 
print(l[n:m] -  [0:n] )


### FIXED CODE ###

n, k = map(int, input().split(" "))

ans = 0
for i in range(k, n+2):
    min = i * ( 0 + i-1) / 2
    max = i * ( (n+1 - i) + n) / 2
    ans += int(max - min + 1)

print(ans % (10**9 + 7))
n=int(input())

list=[]

for i in range(1,10)
	for j in range(1,10)
		list.append(i*j)
    
if n in list:
	print("Yes")
else:
	print("No")

### FIXED CODE ###

n=int(input())
 
list=[]
 
for i in range(1,10):
	for j in range(1,10):
		list.append(i*j)
    
if n in list:
	print("Yes")
else:
	print("No")
import sys
sys.setrecursionlimit(100000)
import numpy as np

directions=np.array([[1,0],[0,1],[-1,0],[0,-1]])


def acinput():
    return list(map(int,input().split(" ")))




import sys
sys.setrecursionlimit(100000)

import numpy as np

directions = [[1, 0], [0, 1], [-1, 0], [0, -1]]
directions = list(map(np.array, directions))

def acinput():
    return list(map(int, input().split(" ")))

N,K=acinput()
s=list(map(int,list(input())))

nums=[1]
for i in range(1,N):
    if s[i]==s[i-1]:
        nums[-1]+=1
    else:
        nums.append(1)


nums_cs=np.cumsum(nums)

if K>1:
    res=nums_cs[2*K-1]
else:
    res=nums_cs[0]
for i in range(len(nums_cs)-2*K-1):
    res=max(res,nums_cs[i+2*K+1]-nums_cs[i])



print(res)


### FIXED CODE ###


import numpy as np
import sys
sys.setrecursionlimit(100000)

directions = np.array([[1, 0], [0, 1], [-1, 0], [0, -1]])


def acinput():
    return list(map(int, input().split(" ")))


sys.setrecursionlimit(100000)


directions = [[1, 0], [0, 1], [-1, 0], [0, -1]]
directions = list(map(np.array, directions))


def acinput():
    return list(map(int, input().split(" ")))


N, K = acinput()
s = list(map(int, list(input())))

nums = [1]
for i in range(1, N):
    if s[i] == s[i-1]:
        nums[-1] += 1
    else:
        nums.append(1)

if s[0] != 1:
    nums.insert(0, 0)
nums_cs = np.cumsum(nums)

res = nums_cs[min(len(nums_cs)-1,2*K)]
# if len(nums_cs) > 1:
#     res = nums_cs[min(len(nums_cs)-1, 2*K-1)]
# else:
#     res = nums_cs[0]

for i in range(1,len(nums_cs)-2*K+1):
    if i % 2 == 0:
        #print(i)
        res = max(res, nums_cs[min(i+2*K,len(nums_cs)-1)]-nums_cs[i-1])


print(res)
import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0] , A)
B = heapq.nlargest(n[1] , B)
C = heapq.nlargest(n[0]+n[1] , C)
for i in range(0,n[0]+n[1]):
    if a==n[0] and m<n[1]:
        saidai = max([ B[m],C[s] ])

        if C[s] >= B[m]:
            s +=1
        else:
            m +=1
    elif a<n[0] and m == n[1]:
        saidai = max([ A[a],C[s] ])

        if C[s] >= A[a]:
            s +=1
        else:
            a +=1

    else:
        saidai=max([ A[a],B[m],C[s] ])

        if A[a] > B[m] and A[a] > C[s]:
            a +=1
        elif A[a] < B[m] and B[m] > C[s]:
            m +=1
        elif C[s] >= B[m] and A[a] <= C[s]:
            s +=1
    
    ans = ans + saidai

print(ans)

### FIXED CODE ###

import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0] , A)
B = heapq.nlargest(n[1] , B)
len = len(C)
if len <(n[0]+n[1]):
    C = heapq.nlargest(len,C)
else:
    C = heapq.nlargest(n[0]+n[1] , C)
for i in range(n[0]+n[1]):
    if s == len:
        if a==n[0] and m<n[1]:
            saidai = B[m]
            m +=1
        else:
            saidai = max([ A[a],B[m] ])
            if A[a] >=B[m]:
                a +=1
            else:
                m +=1

    else:
        if a==n[0] and m<n[1]:
            saidai = max([ B[m],C[s] ])

            if C[s] >= B[m]:
                s +=1
            else:
                m +=1
        elif a<n[0] and m == n[1]:
            saidai = max([ A[a],C[s] ])

            if C[s] >= A[a]:
                s +=1
            else:
                a +=1

        else:
            saidai=max([ A[a],B[m],C[s] ])

            if A[a] >= B[m] and A[a] > C[s]:
                a +=1
            elif A[a] < B[m] and B[m] > C[s]:
                m +=1
            elif C[s] >= B[m] and A[a] <= C[s]:
                s +=1
    
    ans = ans + saidai

print(ans)
import numpy as np
N,M = map(int, input().split())
A = []
for i in range(N):
    A.append(input())
B = []
for i in range(M):
    M.append(input())
A = np.array(A)
B = np.array(B)

for i in range(N-M):
    for j in range(N-M):
        if A[i:i+M][j:j+M] == B:
            print('Yes')
            exit()
print('No')

### FIXED CODE ###

N,M = map(int, input().split())
A = []
for i in range(N):
    A.append(input())
B = []
for i in range(M):
    B.append(input())

for i in range(N-M+1):
    for j in range(N-M+1):
        tmp = [A[i+k][j:j+M] for k in range(M)]
        if tmp == B:
            print('Yes')
            exit()
print('No')
import math

rawUsrInput = input()
usrInput = rawUsrInput.split()

a = int(usrInput[0])
b = int(usrInput[1])
x = int(usrInput[2])

print(90 - float(math.degrees(math.acos((b)/(math.sqrt((4*x**2)/(a**2*b**2)+b**2))))))

### FIXED CODE ###

usrInput = input()
splitedInput = usrInput.split()
clearFlag = []

for i in range(2):
    if int(splitedInput[i]) < 10:
        clearFlag.append(True)
    else:
        clearFlag.append(False)

if bool(clearFlag[0]) == True and bool(clearFlag[1]) == True:
    print(int(splitedInput[0]) * int(splitedInput[1]))
else:
    print(-1)