#include <cstdio>
#include <iostream>
using namespace std;
long long n;
long long k;
long long cal (int num) {
if (!num) {
return 1;
}
long long res = 0;
while (num) {
res += !(num % 10);
num /= 10;
}
return res;
}
int main () {
freopen ("whz_number.in", "r", stdin);
freopen ("whz_number.out", "w", stdout);
while (cin >> n >> k) {
for (; k; n--) {
k -= cal (n);
}
cout << n + 1 << endl;
}
return 0;
}