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: MEDIUM_HARD

Solutions:
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
			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
		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)
rbg.show()


(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)


(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))


def sd(n):
	acc = 0
	while n:
		acc += n % 10
		n //= 10
	return acc

def rb(n, s):
	return n - sd(n) >= s
(n, s) = map(int, input().split(' '))
left = 1
right = n + 1
while left != right:
	mid = (left + right) // 2
	if rb(mid, s):
		right = mid
	else:
		left = mid + 1
print(n - left + 1)


(n, s) = map(int, input().split())
(a, b, c) = (0, n + 1, 0)
while a < b:
	c = (a + b) // 2
	if c - sum([int(x) for x in str(c)]) < s:
		a = c + 1
	else:
		b = c
print(n - b + 1)


def main():
	(n, s) = map(int, input().split())
	a = BS(1, n, s)
	print(n - a + 1)

def BS(f, l, d):
	if f > l:
		return f
	mi = (f + l) // 2
	if mi - sum([int(j) for j in str(mi)]) >= d:
		return BS(f, mi - 1, d)
	else:
		return BS(mi + 1, l, d)
main()


(n, s) = [int(x) for x in input().split()]

def check(x):
	y = list(str(x))
	ans = x
	for i in y:
		ans -= int(i)
	if ans >= s:
		return True
	return False
ans = 0
l = 1
r = n
while l <= r:
	m = (l + r) // 2
	if check(m):
		ans = n - m + 1
		r = m - 1
	else:
		l = m + 1
print(ans)


def case(mid):
	res = 0
	for (k, x) in enumerate(str(mid)):
		res += int(x)
	return res
(n, s) = map(int, input().split())
(i, j) = (0, n)
while i + 1 < j:
	mid = (i + j) // 2
	result = case(mid)
	if mid - case(mid) < s:
		i = mid
	else:
		j = mid
if i - case(i) >= s:
	print(n - i + 1)
elif j == n:
	if j - case(j) >= s:
		print(1)
	else:
		print(0)
else:
	print(n - j + 1)


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

def really_big(ni, s):
	dig_sum = sum(list(map(int, list(str(ni)))))
	return ni - dig_sum >= s
cont = 0
for i in range(s, n + 1):
	if really_big(i, s):
		cont = n - i + 1
		break
print(cont)


f = lambda x: x - sum((int(i) for i in str(x))) >= s
(n, s) = map(int, input().split())
l = 0
r = n + 1
while r - l > 1:
	m = l + r >> 1
	if f(m):
		r = m
	else:
		l = m
print(n - r + 1)


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 main():
	(n, s) = map(int, input().split())
	y = [i for i in range(s, s + 180) if i - sum([int(j) for j in str(i)]) >= s]
	a = y[0]
	print(max(n - a + 1, 0))
main()


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))


R = lambda : map(int, input().split())
(n, s) = R()
(l, r) = (s, 10 ** 18 + 7)

def digit(x):
	res = 0
	while x:
		res += x % 10
		x //= 10
	return res
while l < r:
	m = (l + r) // 2
	if m - digit(m) < s:
		l = m + 1
	else:
		r = m
print(max(0, n - l + 1))


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left, bisect
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
(n, k) = map(int, input().split())
(x, y) = (1, n)
f = 0
while x <= y:
	m = (x + y) // 2
	s = 0
	p = m
	while p > 0:
		s += p % 10
		p = p // 10
	m1 = m - 1
	s1 = 0
	p = m1
	while p > 0:
		s1 += p % 10
		p = p // 10
	if m == 0 or (m - s >= k and m1 - s1 < k):
		f = 1
		break
	elif m - s < k:
		x = m + 1
	else:
		y = m - 1
if f:
	print(n - m + 1)
else:
	print(0)


def d(n):
	ret = 0
	n = list(str(n))
	for i in range(len(n)):
		ret += int(n[i])
	return ret

def main():
	(n, s) = map(int, input().split())
	(l, h) = (0, n)
	for i in range(2000):
		m = (l + h) // 2
		if m - d(m) >= s:
			h = m
		else:
			l = m
	for i in range(-100, 100):
		t = m + i
		if t < 0 or t > n:
			continue
		if abs(t - d(t)) >= s:
			print(n - t + 1)
			exit()
	print(0)
main()


I = lambda : 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)


def sumOfDigits(s):
	sum = 0
	s = str(s)
	for i in range(len(s)):
		sum = sum + int(s[i])
	return sum

def binSearch(s, l, u):
	if (l + u) // 2 + 1 - sumOfDigits((l + u) // 2 + 1) >= s and (l + u) // 2 - sumOfDigits((l + u) // 2) < s:
		return (l + u) // 2
	if (l + u) // 2 - sumOfDigits((l + u) // 2) < s:
		return binSearch(s, (l + u) // 2 + 1, u)
	if (l + u) // 2 - sumOfDigits((l + u) // 2) >= s:
		return binSearch(s, l, (l + u) // 2 - 1)
(n, s) = input().strip().split(' ')
s = int(s)
if int(n) - sumOfDigits(n) < s:
	print(0)
else:
	d = binSearch(s, 1, int(n))
	print(int(n) - d)


def bigNumber(n, s):
	for i in range(s, n + 1):
		sumVal = 0
		num = i
		while num:
			sumVal += num % 10
			num //= 10
		if i - sumVal >= s:
			print(n - i + 1)
			return
	print(0)
(n, s) = (int(x) for x in input().split())
bigNumber(n, s)


from __future__ import print_function
from collections import *
from sys import stdin
from bisect import *
from heapq import *
from math import log2
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
rr = lambda x: reversed(range(x))
mod = int(1000000000.0) + 7
inf = float('inf')
(n, s) = gil()
(l, r) = (1, n)
ans = r + 1

def isPos(x):
	sm = 0
	X = x
	while x:
		md = x % 10
		sm += md
		x = (x - md) // 10
	return X - sm >= s
while l <= r:
	mid = (l + r) // 2
	if isPos(mid):
		r = mid - 1
		ans = mid
	else:
		l = mid + 1
print(max(0, n - ans + 1))


(n, s) = map(int, input().split())
if s >= n:
	print('0')
	exit()
for i in range(s, n + 2):
	cur = int(0)
	for j in str(i):
		cur += int(j)
	if i - cur >= s:
		break
print(n - i + 1)


import sys
import bisect
from bisect import bisect_left as lb
from bisect import bisect_right as rb
input_ = lambda : sys.stdin.readline().strip('\r\n')
from math import log
from math import gcd
from math import atan2, acos
from random import randint
sa = lambda : input_()
sb = lambda : int(input_())
sc = lambda : input_().split()
sd = lambda : list(map(int, input_().split()))
sflo = lambda : list(map(float, input_().split()))
se = lambda : float(input_())
sf = lambda : list(input_())
flsh = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
mod1 = 998244353
gp = []
cost = []
dp = []
mx = []
ans1 = []
ans2 = []
special = []
specnode = []
a = 0
kthpar = []

def dfs(root, par):
	if par != -1:
		dp[root] = dp[par] + 1
	for i in range(1, 20):
		if kthpar[root][i - 1] != -1:
			kthpar[root][i] = kthpar[kthpar[root][i - 1]][i - 1]
	for child in gp[root]:
		if child == par:
			continue
		kthpar[child][0] = root
		dfs(child, root)
ans = 0
b = []

def dfs2(root, par, d):
	global gp, dp
	dp[root] = d
	for child in gp[root]:
		if child == par:
			continue
		dfs2(child, root, d + 1)

def hnbhai(tc):
	(n, s) = sd()
	low = s
	high = n + 1
	ans = n + 1
	while low <= high:
		mid = (low + high) // 2
		ss = sum(list(map(int, list(str(mid)))))
		if mid - ss < s:
			low = mid + 1
		else:
			ans = mid
			high = mid - 1
	print(n - ans + 1)
for _ in range(1):
	hnbhai(_ + 1)


def nine(p):
	s = ''
	for i in range(p):
		s += '9'
	return int(s)

def prosh(p):
	ans = 0
	for i in range(1, p + 1):
		ans += nine(i) * 9
	return ans
(n, k) = map(int, input().split())
l = [0] * 29
for i in range(19):
	e = nine(19 - i)
	l[i] = k // e
	k -= l[i] * e
	if k == 0:
		break
	if i == 18 or k % e > prosh(19 - i - 1):
		l[i] += 1
		break
otv = 0
for i in range(19):
	otv += 10 ** (19 - i) * l[i]
print(max(n - otv + 1, 0))


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

def sumDigit(x):
	s = 0
	while x > 0:
		s += x % 10
		x //= 10
	return s

def lowerBound(l, r):
	while l < r:
		mid = l + r >> 1
		k = mid - sumDigit(mid)
		if k < s:
			l = mid + 1
		else:
			r = mid
	return l
first = lowerBound(0, n + 1)
print(max(0, n - first + 1))


def search(l, r, s, g):
	if l > r:
		return [-1, g]
	mid = (l + r) // 2
	sum = 0
	temp = mid
	while temp > 0:
		sum += temp % 10
		temp //= 10
	if mid - sum == s:
		return [mid - mid % 10, g]
	elif mid - sum > s:
		g = mid - mid % 10
		return search(l, mid - 1, s, g)
	else:
		return search(mid + 1, r, s, g)
(n, s) = map(int, input().split())
g = 0
[num, g] = search(1, n, s, g)
if num == -1 and g == 0:
	print(0)
elif num != -1:
	if num == 0:
		print(n - num)
	else:
		print(n - num + 1)
else:
	print(n - g + 1)


for _ in range(1):
	(n, s) = map(int, input().split())
	lo = 0
	hi = n
	ans = n + 1
	while lo <= hi:
		mi = lo + hi >> 1
		curr = sum((int(i) for i in str(mi)))
		if mi - curr >= s:
			hi = mi - 1
			ans = mi
		else:
			lo = mi + 1
	print(n - ans + 1)


def digit(a):
	s = 0
	while a:
		s += a % 10
		a //= 10
	return s

def big(n, s):
	lo = 1
	hi = n
	while lo <= hi:
		mid = (lo + hi) // 2
		if mid - digit(mid) < s:
			lo = mid + 1
		else:
			hi = mid - 1
	return n - lo + 1
(a, b) = map(int, input().strip().split())
print(big(a, b))


import sys
(n, s) = map(int, input().split())
(ok, ng) = (10 ** 18 + 100, -1)
while abs(ok - ng) > 1:
	mid = ok + ng >> 1
	if mid - sum(map(int, str(mid))) >= s:
		ok = mid
	else:
		ng = mid
print(max(0, n - ok + 1))


def main():
	(n, s) = input().split()
	n = int(n)
	s = int(s)
	ans = n
	ans -= s - 1
	count = 0
	for i in range(s, n + 1):
		i_str = list(str(i))
		total = 0
		for j in i_str:
			total += int(j)
		if i - total >= s:
			break
		count += 1
	ans -= count
	if ans < 0:
		print(0)
	else:
		print(ans)
main()


def main():

	def sumofdigit(n):
		temp = 0
		while n > 0:
			temp += n % 10
			n = n // 10
		return temp

	def F(x):
		return x - sumofdigit(x)

	def findout(s):
		test = s - s % 10 + 10
		while 1:
			if F(test) >= s:
				break
			else:
				test += 10
		return test
	(n, s) = list(map(int, input().strip().split(' ')))
	L = findout(s)
	ans = n - L + 1
	if ans < 0:
		print(0)
	else:
		print(ans)
main()


[n, s] = map(int, input().strip().split())

def sumdigit(x):
	return sum(map(int, str(x)))

def fsum(x):
	return x - sumdigit(x)

def binsearch(s, xmin, xmax):
	while xmax - xmin > 1:
		xmid = (xmax + xmin) // 2
		if fsum(xmid) >= s:
			xmax = xmid
		else:
			xmin = xmid
	return xmax
xmin = 0
xmax = 1
while fsum(xmax) < s:
	xmin = xmax
	xmax *= 2
x = binsearch(s, xmin, xmax)
print(max(n - x + 1, 0))


import sys

def calculate():
	input = sys.stdin.readline().split()
	n = int(input[0])
	s = int(input[1])
	count = 0
	i = s // 10 * 10
	while i <= n:
		if i - sumOfDigits(i) >= s:
			count = n - i + 1
			break
		i = i + 10
	print(count)

def sumOfDigits(numb):
	sum = 0
	while numb > 0:
		sum = sum + numb % 10
		numb = numb // 10
	return sum
calculate()


import math
from math import log2, sqrt
from bisect import bisect_left, bisect_right
import bisect
import sys
from sys import stdin, stdout
import os
sys.setrecursionlimit(pow(10, 6))
import collections
from collections import defaultdict
from statistics import median
inf = float('inf')

def sum_of_no(n):
	suma = 0
	while n:
		suma += n % 10
		n //= 10
	return suma

def get_forward(start, diff):
	if diff == 0:
		return [start + 1, diff]
	diff = diff // 2
	start += diff
	return [start, diff]

def get_backward(start, diff):
	if diff == 0:
		return [start - 1, diff]
	diff = diff // 2
	start -= diff
	return [start, diff]
(n, s) = map(int, input().split())
start = 1
end = n
diff = n - 1
ans = 0
while 1:
	sub = start - sum_of_no(start)
	sub_prev = start - 1 - sum_of_no(start - 1)
	if sub >= s and sub_prev < s:
		ans = start
		break
	if sub >= s:
		(start, diff) = get_backward(start, diff)
	elif sub < s:
		(start, diff) = get_forward(start, diff)
real_ans = n - ans + 1
if real_ans < 0:
	real_ans = 0
print(real_ans)


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)


def works(mid, s):
	return mid - sum(list(map(int, list(str(mid))))) >= s

def main():
	(n, s) = map(int, input().strip().split())
	low = 0
	high = n + 1
	while low + 1 < high:
		mid = (low + high) // 2
		if works(mid, s):
			high = mid
		else:
			low = mid
	print(n - low)
main()


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	(n, s) = map(int, input().split())
	if n < 10:
		print(0)
		return
	tmp = n // 10
	digit = []
	while tmp > 0:
		digit.append(tmp % 10)
		tmp = tmp // 10
	weight = [10 ** i - 1 for i in range(1, len(digit) + 1)]
	mn = n + 1
	for i in range(len(digit) - 1, -1, -1):
		if s // weight[i] > 9:
			break
		if s < weight[i]:
			if 10 ** (i + 1) >= s:
				mn = min(mn, 10 ** (i + 1))
			continue
		temp = s
		j = i
		ans = 0
		while j >= 0:
			t = temp // weight[j]
			if t > 9:
				temp = 0
				ans += 10 ** (j + 2)
				break
			ans += t * 10 ** (j + 1)
			temp = temp - t * weight[j]
			j = j - 1
		if ans != 0:
			ans += math.ceil(temp / 9) * 10
			mn = min(ans, mn)
	if mn > n:
		print(0)
	else:
		print(n - mn + 1)
main()


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)
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))


arr = [int(x) for x in input().split()]
n = arr[0]
s = arr[1]
resp = 0
leng = len(str(s))
j = 0
for i in range(s, s + leng * 9 + 1):
	j = i
	if i > n:
		break
	temp = 0
	c = i
	while c:
		temp += c % 10
		c //= 10
	if i - temp >= s:
		resp += 1
j += 1
if j > n:
	print(resp)
else:
	print(n - j + 1 + resp)


def find(curr_pos, max_pos, curr_s, choose):
	if curr_pos == 0:
		if curr_s <= 0:
			return True
		else:
			return False
	if curr_pos == max_pos:
		low = 1
	else:
		low = 0
	high = 9
	for d in range(low, high + 1):
		curr_val = d * (10 ** curr_pos - 1)
		if curr_val + p[curr_pos - 1] < curr_s:
			continue
		choose[curr_pos] = d
		return find(curr_pos - 1, max_pos, curr_s - curr_val, choose)
	return False
(n, s) = map(int, input().split())
p = [0]
for i in range(1, 19):
	p.append(p[-1] + 9 * (10 ** i - 1))
choose = [0] * 19
ans = n + 1
for num_digit in range(1, 19):
	for i in range(1, num_digit + 1):
		choose[i] = 0
	if find(num_digit, num_digit, s, choose):
		res = 0
		for i in range(num_digit, -1, -1):
			res = res * 10 + choose[i]
		ans = min(ans, res)
		break
print(n - ans + 1)


(n, s) = map(int, input().rstrip().split())
if n <= s:
	print(0)
	exit()
for i in range(s, n + 2):
	l = 0
	for j in str(i):
		l += int(j)
	if i - l >= s:
		break
print(max(n - i + 1, 0))


def digisum(n):
	count = 0
	while n > 0:
		count += n % 10
		n = n // 10
	return count
(n, s) = list(map(int, input().split()))
(l, r) = (1, n)
flag = 0
while l < r:
	m = l + (r - l) // 2
	digi_sum = digisum(m)
	num = m
	if num - digi_sum >= s:
		flag = 1
		cur = m
		r = m
	else:
		l = m + 1
	if r - l == 1:
		digi_sum = digisum(l)
		num = l
		if num - digi_sum >= s:
			flag = 1
			cur = l
			break
		digi_sum = digisum(r)
		num = r
		if num - digi_sum >= s:
			flag = 1
			cur = r
			break
if flag == 0:
	digi_sum = digisum(l)
	num = l
	if num - digi_sum >= s:
		flag = 1
		cur = l
if flag == 0:
	print(0)
else:
	print(n - cur + 1)


(n, s) = map(int, input().strip().split())
num = ''
div = 9
if s // 10 != 0:
	div = 9
	while s // div // 10 != 0:
		div = div * 10 + 9
	while div:
		rem = str(s // div)
		if int(rem) > 9:
			num = str(int(num) + 1) + '0' * len(str(div))
			div = 0
			s = 0
			break
		else:
			num += rem
		s = s % div
		div //= 10
	num += str(s)
else:
	num = str(s)
mini = int(num)
if mini % 10 != 0:
	mini += 10
	mini -= mini % 10
print(max(0, n - mini + 1))


def forninho(miolo, s):
	premiolo = miolo
	temp = 0
	while miolo > 0:
		temp += miolo % 10
		miolo = miolo // 10
	if premiolo - temp >= s:
		return 1
	else:
		return 0
entrada = input().split()
n = int(entrada[0])
s = int(entrada[1])
result = -1
l = 1
r = n
while r - l >= 0:
	miolo = (l + r) // 2
	if forninho(miolo, s) == 1:
		r = miolo - 1
		result = miolo
	else:
		l = miolo + 1
if result == -1:
	print('0')
else:
	print(n - result + 1)


(n, s) = map(int, input().split())
if s >= n:
	print(0)
else:
	ans = 0

	def sod(n):
		s = str(n)
		ret = 0
		for i in s:
			ret += int(i)
		return ret
	for nd in range(s, s + 1000):
		if nd - sod(nd) >= s:
			ans += 1
		if nd == n:
			break
		if nd == s + 369:
			ans += n - nd
			break
	print(ans)


def somaDigitos(x):
	resp = 0
	while x > 0:
		resp += x % 10
		x = x // 10
	return resp

def isReallyBigNumber(x):
	return x - somaDigitos(x) >= s
(n, s) = input().split(' ')
n = int(n)
s = int(s)
count = 0
ini = 1
fim = n
i = 0
ans = False
while ini <= fim:
	meio = (ini + fim) // 2
	if isReallyBigNumber(meio):
		ans = meio
		fim = meio - 1
	else:
		ini = meio + 1
if ans:
	print(n - ans + 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) = map(int, input().split())
counter = 0
if n >= s:
	for d in range(s, n + 1):
		c = 0
		f = d
		while d != 0:
			e = d % 10
			c = c + e
			d = int(d // 10)
		check = f - c
		if check < s:
			counter = counter + 1
		else:
			break
	x = n + 1 - counter - s
	print(x)
else:
	x = 0
	print(x)


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)


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

def binsearch(n, s):
	left = 0
	right = n
	while left <= right:
		mid = (left + right) // 2
		digits = sum([int(i) for i in list(str(mid))])
		if mid - digits >= s:
			right = mid - 1
		else:
			left = mid + 1
	return right
print(max(0, n - binsearch(n, s)))


def somadig(x):
	soma = 0
	while x > 0:
		soma += x % 10
		x = x // 10
	return soma

def main():
	(x, s) = map(int, input().split())
	comeco = 9
	fim = x
	if comeco >= fim:
		print(0)
		return
	while fim >= comeco:
		meio = (fim + comeco) // 2
		if meio - somadig(meio) >= s:
			if meio - 1 - somadig(meio - 1) < s:
				print(x - (meio - 1))
				return
			fim = meio - 1
		else:
			comeco = meio + 1
	print(0)
	return
main()


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

def ver(i):
	t = str(i)
	ans = 0
	for j in t:
		ans += int(j)
	return ans
l = len(str(s))
if n < s:
	print(0)
	exit()
if s + 10 * (l ** 2 + 1) <= n:
	ans = n - s + 1 - 10 * (l ** 2 + 1)
	for i in range(s, s + 10 * (l ** 2 + 1)):
		if s + ver(i) <= i:
			ans += 1
else:
	ans = 0
	for i in range(s, n + 1):
		if s + ver(i) <= i:
			ans += 1
print(ans)


import sys
from bisect import bisect_right as lb
from collections import deque
from queue import PriorityQueue as pq
from math import *
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
inv = lambda x: pow(x, mod - 2, mod)
mod = 10 ** 9 + 7
(n, s) = il()
l = s
h = n
ans = n + 1
while l <= h:
	m = (l + h) // 2
	t = 0
	for i in str(m):
		t += int(i)
	if m - t >= s:
		ans = m
		h = m - 1
	else:
		l = m + 1
print(n - ans + 1)


(n, s) = map(int, input().split())
r = 0
v = min(n + 1, s + 19 * 9)
for i in range(s, v):
	zz = f'{i}'
	sm = i
	for z in zz:
		sm -= int(z)
	if sm >= s:
		r += 1
print(r + n - v + 1)


def readints():
	return [int(item) for item in input().strip().split()]

def f(n):
	return n - sum(map(int, str(n)))

class Solver:

	def main(self):
		(n, s) = readints()
		if f(n) < s:
			print('0')
			return
		(l, r) = (1, n)
		while l <= r:
			mid = (l + r) // 2
			if f(mid) < s:
				l = mid + 1
			if f(mid) >= s:
				r = mid - 1
		print(n - r)
Solver().main()


def sum_of_digits(n):
	ans = 0
	while n:
		ans += n % 10
		n //= 10
	return ans
(n, s) = map(int, input().split())
lo = 0
hi = n
x = n + 1
while lo <= hi:
	mid = (lo + hi) // 2
	if mid - sum_of_digits(mid) >= s:
		x = min(mid, x)
		hi = mid - 1
	else:
		lo = mid + 1
print(n - x + 1)


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

def sum_of_digits(n):
	ans = 0
	for c in str(n):
		ans += int(c)
	return ans
m = s + 10 - s % 10
while m - sum_of_digits(m) < s:
	m += 10
if m <= n:
	print(n - m + 1)
else:
	print(0)


(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)


def summing(number):
	summa = 0
	while number > 0:
		summa += number % 10
		number = number // 10
	return summa

def result(n, s):
	z = min(s, n)
	while z <= n and z - summing(z) < s:
		z += 1
	return n - z + 1
(a, b) = [int(i) for i in input().split()]
print(result(a, b))


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))


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]))


(n, s) = map(int, input().split())
(x, y) = divmod(s, 9)
if not s:
	x = 0
elif y:
	x += 1
low = x * 9
for i in range(low, low + 10000):
	if i - sum([int(c) for c in str(i)]) >= s:
		low = i
		break
print(max(n - low + 1, 0))


(n, s) = map(int, input().split())
if s >= n:
	print('0')
else:
	for i in range(s, n + 2):
		l = 0
		for j in str(i):
			l += int(j)
		if i - l >= s:
			break
	print(n - i + 1)


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)

def ok(x):
	y = sum(map(int, list(str(x))))
	return x - y >= s
(n, s) = map(int, input().split())
(l, h) = (0, n)
a = n
while l <= h:
	m = l + h >> 1
	if ok(m):
		a = m - 1
		h = m - 1
	else:
		l = m + 1
print(n - a)


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)))