cpp
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,x,ans=0;
cin>>n>>x;
for(int i=1;i<=n;i++)
{
int number=i;
while(number)
{
int a=number%10;
number/=10;
if(a==x) ans++;
}
}
cout<<ans<<endl;
return 0;
}