program count; var i,n,x,j,ans:longint; a:string; b:char; begin assign(input,'count.in');reset(input); assign(output,'count.out');rewrite(output); readln(n,x); ans:=0; b:=chr(x+ord('0')); for i:= x to n do begin str(i,a); for j:=1to length(a) do if a[j]=b then inc(ans); end; writeln(ans); close(input); close(output); end.