#include <bits/stdc++.h>
const int N = 1e5 + 1;
const long long inf = (long long)1e18 + 1;
using namespace std;
int n, m;
int ans;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  while (ans != m) {
    if (ans == m) {
      cout << n, exit(0);
    }
    if (n % 10 != 0) {
      ans++;
      n--;
    }
    if (ans == m) {
      cout << n, exit(0);
    }
    if (n % 10 == 0) {
      n /= 10;
      ans++;
    }
  }
  cout << n, exit(0);
}
