Polycarp is crazy about round numbers. He especially likes the numbers divisible by 10^{k}.

In the given number of n Polycarp wants to remove the least number of digits to get a number that is divisible by 10^{k}. For example, if k = 3, in the number 30020 it is enough to delete a single digit (2). In this case, the result is 3000 that is divisible by 10^3 = 1000.

Write a program that prints the minimum number of digits to be deleted from the given integer number n, so that the result is divisible by 10^{k}. The result should not start with the unnecessary leading zero (i.e., zero can start only the number 0, which is required to be written as exactly one digit).

It is guaranteed that the answer exists.


-----Input-----

The only line of the input contains two integer numbers n and k (0 ≤ n ≤ 2 000 000 000, 1 ≤ k ≤ 9).

It is guaranteed that the answer exists. All numbers in the input are written in traditional notation of integers, that is, without any extra leading zeros.


-----Output-----

Print w — the required minimal number of digits to erase. After removing the appropriate w digits from the number n, the result should have a value that is divisible by 10^{k}. The result can start with digit 0 in the single case (the result is zero and written by exactly the only digit 0).


-----Examples-----
Input
30020 3

Output
1

Input
100 9

Output
2

Input
10203049 2

Output
3



-----Note-----

In the example 2 you can remove two digits: 1 and any 0. The result is number 0 which is divisible by any number.

Difficulty: interview

Starter code:

Solutions:
s = input().split()
k = int(s[1])
s = s[0]
if s.count('0') < k:
    if s.count('0') > 0:
        print(len(s) - 1)
    else:
        print(len(s))
    return
have = 0
its = 0
for i in range(len(s) - 1, -1, -1):
    its += 1
    if s[i] == '0':
        have += 1
    if have == k:
        print(its - have)
        return

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

A = list(str(n))
A = A[::-1]

_k = k

i = 0
ans = 0

while k and i < len(A):
	if(A[i] != '0'):
		ans += 1
	else:
		k -= 1
	i += 1

if(k):
	if(k != _k):
		print(len(A) - 1)
	else:
		print(len(A))
else:
	print(ans)

a,k = input().split()
k = int(k)
start = -1
for j in range(len(a)):
    if a[j] != '0':
        start = j
        break
ans = 0
for j in range(len(a)-1,j,-1):
    if k != 0:
        if a[j] == '0':
            k-=1
        else:
            ans+=1
    else:
        break

if k == 0:
    print(ans)
else:
    print(len(a)-1)

s = input().split()
k = int(s[1])
n = s[0]
ptr = len(s[0]) - 1
zerocount = 0
ans = 0
while ptr >= 0 and zerocount < k:
    if n[ptr] == '0':
        zerocount += 1
    else:
        ans += 1
    ptr -= 1
if ptr == -1:
    print(len(n) - 1)
else:
    
    print(ans)


def main():
    n, k = list(map(int, input().split()))
    if n == 0 or k == 0:
        print(0)
    else:
        s = str(n)
        res = 0
        for i in range(len(s)-1, -1, -1):
            if s[i] == '0':
                k -= 1
            else:
                res += 1
            if k == 0:
                break
        if k == 0:
            print(res)
        else:
            print(len(s)-1)

def __starting_point():
    main()

__starting_point()

n, k = input().split()
k = int(k)
s = sum([x=="0" for x in n])
if s < k:
  print(len(n) - 1)
else:
  res = 0
  for ch in reversed(n):
    if ch == "0":
      k -=1
      if not k: break
    else:
      res += 1
  print(res)      


n,k=input().split()
k=10**int(k)
a=len(n)-1
s=0
while int(n)%k!=0:
    for i in range(len(n)-1,-1,-1):
        if n[i]!='0':n=n[:i]+n[i+1:];s+=1;break
print(a if set(list(n))=={'0'} else s)


s = input().split()
n = s[0]
k = int(s[1])

ans = 0
cur = 0
for i in n[::-1]:
    if i == '0':
        cur += 1
    elif cur < k:
        ans += 1
if n.count('0') < k:
    if n.count('0') > 0:
        print(len(n) - 1)
    else:
        print(len(n))
else:
    print(ans)



import sys
n,k = list(map(int, input().split()))
num = list(reversed(str(n)))
ans = 0
zeros = 0
if num.count('0') < k:
    print(len(num) -1)
    return
for ch in  num:
    if ch == '0':
        zeros += 1
        if zeros == k:
            break;
        continue
    ans += 1

print(ans)

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

zeroes = 0
deletes = 0

good = False

for c in str(n)[::-1]:
    if c == "0":
        zeroes += 1
        if zeroes == k:
            good = True
            break
    else:
        deletes += 1

if good:
    print(deletes)
elif zeroes >= 1:
    print(len(str(n)) - 1)


n,k=input().split()
k=int(k)
l=len(n)
s=list(reversed(list(map(int,n))))
c=0
n=0
while c<k:
    try:
        if s[c]==0:
            c+=1
        else:
            s.pop(c)
            n+=1
    except IndexError:break
if s[-1]==0:
    print(l-1)
else:
    print(n)


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

ans = 0
nz = 0
for c in reversed(n):
    if nz == k:
        break
    if c == '0':
        nz += 1
    else:
        ans += 1
else:
    ans = len(n) - 1

print(ans)


a = list(input().split())
n = a[0]
k = int(a[1])

c = 0
f = 0
for x in range(-1, -len(n)-1, -1):
	if n[x] == "0":
		c = c + 1
		if c == k:
			print(  -x-k  )
			f = 1
			break

if f == 0:
	print(len(n) - 1)


n, k = [int(x) for x in input().split()]
s = str(n)
ans = 0
nulls = 0
f = False
for i in range(len(s) - 1, -1, -1):
    if s[i] != '0':
        ans += 1
    else:
        nulls += 1
    if k == nulls:
        f = True
        ans = len(s) - i - nulls
        break
if f:
    print(ans)
else:
    print(len(s) - 1)




s,k=input().split()
k=int(k)
i=-1
count=0
while k>0:
    try:
        if s[i]=='0':
            k-=1
            i-=1
        else:
            i-=1
            count+=1
    except:
        if '0' in s:
            count=len(s)-1
        else:
            count=len(s)
        break
print(count)


# your code goes here
n, k = input().strip().split()
k = int(k)
n_ = ""
count = 0
count_rem = 0
possible = False
for i in reversed(n):
	# print(count, count_rem)
	if count >= k:
		possible = True
		break
	elif i is "0":
		count+=1
	else:
		count_rem += 1
		
if possible:
	print(count_rem)
elif count is 0: 
	print(len(n))
else:
	print(len(n) - 1)

from sys import stdin, stdout


s, k = stdin.readline().split()
k = int(k)

ans = 0
cnt = 0
for i in range(len(s) - 1, -1, -1):
    if s[i] != '0':
        ans += 1
    elif s[:i + 1].count('0') != len(s[:i + 1]):
        cnt += 1
    
    if cnt == k:
        stdout.write(str(ans))
        break
else:
    stdout.write(str(len(s) - 1))

from sys import stdin, stdout

num,k = list(map(int, stdin.readline().rstrip().split()))

numStr=str(num)
if num==0:
    print(0)
elif numStr.count('0')==0:
    print(len(numStr))
elif numStr.count('0')<k:
    print(len(numStr)-1)
else:
    numReverse=numStr[::-1]
    zeroCount=0
    deleted=0
    i=0
    while zeroCount<k:
        if numReverse[i]=='0':
            zeroCount+=1
        else:
            deleted+=1
        i+=1
    print(deleted)


import math, sys
def main():
	s = input().split()
	k = int(s[1])
	n = s[0]
	l = len(n)
	ans=0
	for i in range(l):
		if (i-ans == k):
			print(ans)
			return
		if n[l-i-1]!='0':
			ans+=1
	if (l-ans>0):
		print(l-1)

def __starting_point():
	main()

__starting_point()

n,k = [int(i) for i in input().split()]

if n % 10 ** k == 0:
    print(0)
    return

if str(n).count('0') < k:
    print(len(str(n)) - 1)
    return

ans = 0

st = str(n)
j = len(st)-1

while int(st) % 10 ** k != 0:
    while int(st) % 10 ** k != 0 and st[j] != '0':
        st = st[:j] + st[j+1:]
        j -= 1
        ans += 1

    while int(st) % 10 ** k != 0 and st[j] == '0':
        j-=1

print(ans)


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

n = n[::-1]

cc = 0
cz = 0
c = len(n)
for i in range(c):
    if int(n[i]) == 0:
        cz += 1
    else:
        if cz >= k:
            break
        else:
            cc += 1
if cz < k:
    print(c - 1)
else:
    print(min(c - 1, cc))


def LI(): return list(map(int, input().split()))
def II(): return int(input())
def LS(): return input().split()
def S(): return input()

def n(lil):
    for i in range(len(lil),-1, -1):
        if lil[i-1] != '0':
            return lil[:i-1]+lil[i:]


li = input().split()
k = 0
while True:
    if int(li[0])%(10**int(li[1])) != 0:
        li[0] = n(li[0])
        k+=1
        continue
    else:
        if li[0] == '0' * len(li[0]):
            k += (len(li[0]) -1) 
        break
    
print(int(k))

l = input().split()
k = int(l[1]) ; n = l[0]
n = n[::-1]
def compute() :
	j = 0 ; i = 0 ; ans  = 0
	if len(n) <= k  :
		return len(n)-1
	while j < k and i < len(n) :
		if  n[i] != '0' : 
			ans += 1
		else: j+= 1
		i += 1
	if i == len(n) and j < k :
		return len(n)-1
	else:
		return ans
print(compute())

import sys


def make_gen(str):
    arr = str.split(" ")
    for item in arr:
        yield item


s = input()
s = make_gen(s)

n = next(s)
k = int(next(s))

count = 0
deleted = 0
for i in range(0, len(n)):
    if (n[-i-1] == "0"):
        count += 1
        if count == k:
            break
    else:
        deleted += 1

if (count < k):
    if (count > 0):
        print(len(n) - 1)
    else:
        print(len(n))
else:
    print(deleted)


n, k = input().split()
k = int(k)
cnt = 0
for i in n:
    if i == "0":
        cnt += 1
if cnt < k:
    print(len(n) - 1)
else:
    p = 0
    ans = 0
    i = len(n) - 1
    while ans < k:
        if n[i] == "0":
            ans += 1
        else:
            p += 1
        i -= 1
    print(p)