#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
freopen("whz_number.in", "r", stdin);
freopen("whz_number.out", "w", stdout);
unsigned long long k;
while (cin >> n >> k) {
unsigned long long cnt = 0;
for (int i = n; i >= 0; i--) {
int tmp = i;
while (tmp != 0) {
if (tmp % 10 == 0)
cnt++;
tmp /= 10;
}
if (cnt == k) {
cout << i << endl;
break;
}
if (i == 0 && cnt <= k) {
cout << 0 << endl;
break;
}
}
}
return 0;
}