n,num = map(int,input().split())
str1 = []
count = 0
for i in range(1,n+1):
str1.append(i)
str2= "".join(["".join(str(str1[i]))for i in range(0,n)])
for i in str2:
if str(num) == i:
count+=1
print(count)
# print("".join(str1))
n,num = map(int,input().split())
str1 = []
count = 0
for i in range(1,n+1):
str1.append(i)
str2= "".join(["".join(str(str1[i]))for i in range(0,n)])
for i in str2:
if str(num) == i:
count+=1
print(count)
# print("".join(str1))