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