#include<stdio.h> int main() { int n = 0; int x = 0; int i = 0; scanf("%d %d",&n,&x); int count = 0; for(i = 1;i<=n;i++) { if(i > 9) { int tmp = i; while(tmp > 0) { if(tmp%10 == x) count++; tmp = tmp/10; } } if(i == x) count++; } printf("%d",count); return 0; }