n, x = input().split()
res = ''
for i in range(1, int(n)+1):
    res += str(i)
print(res.count(x))