#include <bits/stdc++.h> using namespace std; int n, x, ans; int main() { cin >> n >> x; for(int i = 1; i <= n; i++) { string s = to_string(i); for(int j = 0; j < s.size(); j++) { if(s[j] - '0' == x) { ans++; } } } cout << ans; return 0; }