Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different special properties, he wants to know how rare (or not rare) they are — in fact, he needs to calculate the quantity of really big numbers that are not greater than n.

Ivan tried to do the calculations himself, but soon realized that it's too difficult for him. So he asked you to help him in calculations.


-----Input-----

The first (and the only) line contains two integers n and s (1 ≤ n, s ≤ 10^18).


-----Output-----

Print one integer — the quantity of really big numbers that are not greater than n.


-----Examples-----
Input
12 1

Output
3

Input
25 20

Output
0

Input
10 9

Output
1



-----Note-----

In the first example numbers 10, 11 and 12 are really big.

In the second example there are no really big numbers that are not greater than 25 (in fact, the first really big number is 30: 30 - 3 ≥ 20).

In the third example 10 is the only really big number (10 - 1 ≥ 9).

Difficulty: interview

Starter code:

Solutions:
def check(x, s):
    k = 0
    for i in str(x):
        k += int(i)
    return x - k >= s


n, s = map(int, input().split())
l = 0
r = n
while r - l > 1:
    m = (l + r) // 2
    if check(m, s):
        r = m
    else:
        l = m
if check(r, s):
    print(n - r + 1)
else:
    print(0)

inp=input().split()
n=int(inp[0])
s=int(inp[1])
start=s+1
thresh=s+500
ans=0
if(n>thresh):
	ans+=n-thresh
else:
	thresh=n
val=0
for i in range(start,thresh+1):
	val=i
	while(i>0):
		val-=i%10
		i=i//10
	if(val>=s):
		ans+=1
print(ans)

def sum_dig(num):
        num = str(num)
        ans = 0
        for i in range(len(num)):
               ans += int(num[i])
        return ans

n,s = list(map(int,input().split()))
ans = 0
for i in range(s,n+1):
        if i - sum_dig(i) >= s:
                ans = n - i + 1
                break
print(ans)


from sys import stdin, stdout

n, s = map(int, stdin.readline().split())

l = 0
r = n + 1
while r - l > 1:
    f = lambda x: sum(map(int, list(str(x))))
    m = (r + l) // 2
    
    if m - f(m) >= s:
        r = m
    else:
        l = m

while r == f(r):
    r += 1


stdout.write(str(max(0, n - r + 1)))

def f(n):
    rtn = n
    while 0 < n:
        rtn -= n % 10
        n //= 10
    return rtn

n, s = list(map(int, input().split()))
l = 0
r = 10**18 + 1
cnt = 0
while 1 < r - l:
    m = (l + r) // 2
    if s <= f(m):
        r = m
    else:
        l = m

print(max(n - r + 1, 0))


def f(x):
	ans = x
	while x > 0:
		ans -= x % 10
		x //= 10
	return ans
n, s = list(map(int, input().split()))
if f(n) < s:
	print(0)
	return
l, r = 1, n
while l < r:
	m = (l + r) // 2
	if f(m) >= s:
		r = (m // 10) * 10
	else:
		l = m + 1
print(n - l + 1)


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

ans = 0
p = s
for i in range(163):
	p = s + i
	if p > n:
		break
	if p >= s + sum(map(int, str(p))):
		ans += 1

if p <= n:
	ans += n - p

print(ans)

def f(x):
	ans = x
	while x > 0:
		ans -= x % 10
		x //= 10
	return ans
n, s = list(map(int, input().split()))
if f(n) < s:
	print(0)
	return
l, r = 1, n
while l < r:
	m = (l + r) // 2
	if f(m) >= s:
		r = (m // 10) * 10
	else:
		l = m + 1
print(n - l + 1) 


from math import ceil
n, s = [int(i) for i in input().split()]

l = 0
r = 10000000000000000000

while l < r:
    cur = (l + r) // 2
    sm = sum([int(i) for i in str(cur)])
    if cur - sm >= s:
        r = cur
    else:
        l = cur + 1

print(max(0, n - l + 1))


n,s = map(int, input().split())
mdist = 10**5
c = s 
ans = 0 
def mySum(c):
  s = str(c)
  ret = 0 
  for x in s:
    ret += ord(x) - ord('0')
  return ret 
while mdist and c <= n:
  if c - mySum(c) >= s:
    ans += 1 
    
  mdist -= 1 
  c += 1 
c = min(c, n + 1)
print(ans + n - c + 1)

n, s = map(int, input().split())
l = 1
r = n + 1
while r > l + 1:
    m = (l + r) // 2
    #print(m)
    line = str(m)
    if m - sum(int(k) for k in line) >= s:
        r = m
    else:
        l = m
line = str(l)
if l - sum(int(k) for k in line) >= s:
    r = l
print(max(n - r + 1, 0))

I = lambda : list(map(int, input().split()))
n, s = I()
cnt = n-min(200+s, n+1)+1
for i in range(s, min(200 + s, n+1)):
    if i - sum(map(int, str(i))) >= s:
        cnt += 1
print(cnt)


class ReallyBigNumbers:

	def __init__(self, n, s):
		self.n = n
		self.s = s
		self.binarySearch()

	def binarySearch(self):
		l = self.s
		h = 10000000000000000000
		while(l < h):
			mid = (h + l) // 2
			#print(mid, self.isReallyBig(mid))
			if self.isReallyBig(mid):
				h = mid
			else:
				l = mid + 1
		self.x = int(l)

	def isReallyBig(self, v):
		cp = v
		add = 0
		while v > 0:
			add += v % 10
			v //= 10
		#print('resta', cp-add, cp, add)
		return (cp - add) >= self.s

	def show(self):
		if self.x <= self.n:
			print(str(self.n - self.x + 1))
		else:
			print(0)


n, s = list(map(int, input().split()))
rbg = ReallyBigNumbers(n, s)
#print(rbg.x)
rbg.show()



# -*- coding: utf-8 -*-
n, s = list(map(int, input().split(' ')))
def sumd(d):
    sd = 0
    while d!=0:
        sd += d%10
        d//=10
    return sd
st, ed = 1, n
r = 0
while True:
    if st==ed:
        r = st
        break
    x = (st+ed)//2
    if x-sumd(x)<s:
        st = x+1
    else:
        ed = x
if r-sumd(r)>=s:
    print(n-r+1)
else:
    print(0)


def f(x):
  return (x if x < 10 else f(x // 10) + x % 10)
n, s = map(int, input().split())
x = s
while x - f(x) < s:
  x += 1
print(max(0, n - x + 1))

n, s  = [int(i) for i in input().split()]
print(max(n - ([i for i in range(s, s + 9 * 18 + 1) if i - sum([int(j) for j in str(i)]) >= s] + [int('1' *  18)])[0] + 1, 0))


n, s  = [int(i) for i in input().split()]
print(max(n - [i for i in range(s, s + 180) if i - sum([int(j) for j in str(i)]) >= s][0] + 1, 0))


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

def diff(m):
    return m - sum([int(k) for k in list(str(m))])
    
def digit_safe(k):
    r = len(list(str(k)))
    return toint(["1"]+["0"]*(r-1))
a = list(str(n))
b = list(str(s))
d = int(a[0])

def toint(l):
    return int("".join(l))
res = 0
for i in range(d):
    z = toint([str(i)] + ["0" for _ in range(len(a)-1)])
    z1 = toint([str(i+1)] + ["0" for _ in range(len(a)-1)])
    count = diff(z)
    while z < z1 and count < s:
        z += digit_safe(s-count)
        count = diff(z)
    if z <= z1:
        res += (z1-z)
z = toint([str(d)] + ["0" for _ in range(len(a)-1)])
z1 = n+1
count = diff(z)
while z < z1 and count < s:
    z += digit_safe(s-count)
    count = diff(z)
if z <= z1:
    res += (z1-z)
print(res)

def calc(n):
	val = n
	cnt = 0
	while(val):
		cnt += val%10
		val//=10
	return n-cnt
		
n,s = list(map(int,input().split()))
if n<=s:
	print(0)
	return
val = s
val //= 10
if val==0:
	print(n-9 if n>=9 else 0)
	return
val *= 10
while calc(val)<s:
	val += 10
	if val>n:
		print(0)
		break
else:
	print(n-val+1)


# def sum_digits(n):
#     s = 0
#     while n:
#         s += n % 10
#         n //= 10
#     return s


# n, s = map(int, input().split())

# count = 0
# summ = sum_digits(n)
# # k = sum_digits(n - n%10 - 1)
# # print(k)
# for num in range(n, 9, -1):
# 	if num % 10 == 9:
# 		summ = sum_digits(num)
# 	# print(num, summ)
# 	if num - summ  >= s:
# 		count += 1
# 	summ -= 1
	


# print(count)


def sum_digits(n):
    s = 0
    while n:
        s += n % 10
        n //= 10
    return s

def binsearch(l, r, elem):
	n = r
	medium = (l + r ) // 2
	s = medium - sum_digits(medium)
	s1 = medium-1- sum_digits(medium-1)
	s2 = medium+1 - sum_digits(medium+1)
	# print(s,s2)
	while not(s2 >= elem and s < elem): #s >= elem and s1 < elem or 
		# print(l,medium,r)
		if s < elem:
			l = medium
		elif s >= elem:
			r = medium
		k = medium
		medium = (l + r ) // 2
		if k == medium:
			break
		# print(l,medium,r)
		s = medium - sum_digits(medium)
		s2 = medium+1 - sum_digits(medium+1)
		# print(s,s2)

	s1 = medium-1 - sum_digits(medium-1)
	if s >= elem and s1 < elem:
		return medium
	elif s2 >= elem and s < elem:
		return medium + 1
	else:
		return 	n+1

n, s = list(map(int, input().split()))
# a = [i for i in range(n+1)]
if n == s:
	print(0)
else:

	y = binsearch( 0, n, s)
# print(y)
	print(n - y + 1)






# def sum_digits(n):
#     s = 0
#     while n:
#         s += n % 10
#         n //= 10
#     return s


# n, s = map(int, input().split())

# count = 0
# summ = sum_digits(n)
# # k = sum_digits(n - n%10 - 1)
# # print(k)
# for num in range(n, 9, -1):
# 	if num % 10 == 9:
# 		summ = sum_digits(num)
# 	# print(num, summ)
# 	if num - summ  >= s:
# 		count += 1
# 	summ -= 1
	


# print(count)


def sum_digits(n):
    s = 0
    while n:
        s += n % 10
        n //= 10
    return s

def binsearch(l, r, elem):
	n = r
	medium = (l + r ) // 2
	s = medium - sum_digits(medium)
	s1 = medium-1- sum_digits(medium-1)
	s2 = medium+1 - sum_digits(medium+1)
	# print(s,s2)
	while not(s2 >= elem and s < elem): #s >= elem and s1 < elem or 
		# print(l,medium,r)
		if s < elem:
			l = medium
		elif s >= elem:
			r = medium
		k = medium
		medium = (l + r ) // 2
		if k == medium:
			break
		# print(l,medium,r)
		s = medium - sum_digits(medium)
		s2 = medium+1 - sum_digits(medium+1)
		# print(s,s2) 

	s1 = medium-1 - sum_digits(medium-1)
	if s >= elem and s1 < elem:
		return medium
	elif s2 >= elem and s < elem:
		return medium + 1
	else:
		return 	n+1

n, s = list(map(int, input().split()))
# a = [i for i in range(n+1)]
if n == s:
	print(0)
else:

	y = binsearch( 0, n, s)
# print(y)
	print(n - y + 1)






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


n, s = read_ints()


def judge(x):
    return x - sum(map(int, str(x))) >= s


result = len([x for x in range(s, min(n, s + 180) + 1) if judge(x)]) + max(0, n - s - 180)

print(result)


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

def sum_digits(x):
    z=0
    while x:
        z+=x%10
        x//=10
    return z

i=s
count=0
while i<=n:
    q=i-sum_digits(i)
    if q>=s:
        count=n-i+1
        break
    else:
        i+=1
print(count)

#print(sum_digits(1))
    
    


a = input()
a = a.split(' ')
a = list(map(int,a))
def really_big(n,s):
    if s >= n:
        return 0
    i = s + 1
    while i <= n:
        t,b = i,0
        while t > 0:
            b = b + (t % 10)
            t = t // 10
        if i - b >= s:
            return n - i + 1
            break
        else:
            i += 1
    return 0
print(really_big(a[0],a[1]))

def cmp(x1 = [],x2 = []):
    len1 = len(x1)
    len2 = len(x2)
    if len1 == len2:
        for i in range(len1):
            n1 = x1[len1 - 1 - i]
            n2 = x2[len1 - 1 - i]
            if n1 != n2:
                return n1 > n2
    else:
        return len1 > len2
    return True

def add(x1 = [],x2 = []):
    if not cmp(x1,x2):
        x1,x2 = x2,x1
    len1 = len(x1)
    len2 = len(x2)
    for i in range(len1 - len2):
        x2.append(0)
    res = []
    flag = 0
    for n1,n2 in zip(x1,x2):
        m = n1 + n2 + flag
        flag = m // 10
        res.append(m % 10)
    if flag:
        res.append(flag)
    return res
    
def minus(x1 = [],x2 = []):
    if not cmp(x1,x2):
        x1,x2 = x2,x1
    len1 = len(x1)
    len2 = len(x2)
    for i in range(len1 - len2):
        x2.append(0)
    res = []
    flag = 0
    for n1,n2 in zip(x1,x2):
        m = n1 - n2 + flag
        flag = 0 if m >= 0 else -1
        res.append((m + 10) % 10)
    
    while res and not res[-1]:
        res.pop()
    return res
    
def div(x1 = [], x2 = 9):
    if x2 == 10:
        return x1[1:]
    else:
        x1.reverse()
        res = []
        mod = 0
        for n in x1:
            res.append((n + mod * 10)// 9)
            mod = (n + mod * 10) % 9
    res.reverse()
    while res and not res[-1]:
        res.pop()
    return res   

def multi(x1 = [],x2 = 9):
    x1_copy = x1.copy()
    x1.insert(0,0)
    if x2 == 10:
        return x1
    else:
        return minus(x1,x1_copy)

def __starting_point():
    input_str = input()
    n,s = [a for a in input_str.split()]
    nl = list([int(a) for a in list(n)])
    sl = list([int(a) for a in list(s)])
    nl.reverse()
    sl.reverse()
    
    x = multi(div(add(sl.copy(),[8]),9),9)
    y = multi(div(add(x.copy(),[9]),10),10)
    sumy = list([int(a) for a in list(str(sum(y)))])
    sumy.reverse()
    while not cmp(minus(y,sumy),sl):
        y = add(y,[0,1])
        sumy = list([int(a) for a in list(str(sum(y)))])
        sumy.reverse()

    if cmp(nl,y):
        ans = add(minus(nl,y),[1])
    else:
        ans = [0]
    ans.reverse()
    ansstr = [str(a) for a in ans]
    print("".join(ansstr))



__starting_point()