importjava.util.Scanner;publicclassMain{publicstaticvoidmain(String[] args){Scanner sc =newScanner(System.in);int n = sc.nextInt();int res =0;int x = sc.nextInt();for(int i=1;i<=n;i++){String s = i +"";for(int j=0;j<s.length();j++){int c = s.charAt(j)-'0';if(c == x)
res++;}}System.out.println(res);}}