#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, r, noOfDigits = 0;
  cin >> n >> k;
  vector<int> vect;
  while (n) {
    r = n % 10;
    vect.push_back(r);
    n = n / 10;
    noOfDigits++;
  }
  reverse(vect.begin(), vect.end());
  int result = accumulate(vect.begin(), vect.end(), 0,
                          [](int acc, int val) { return 10 * acc + val; });
  for (int i = 1; i <= k; i++) {
    if ((result % 10) != 0) {
      result = result - 1;
    } else {
      result = result / 10;
    }
  }
  cout << result;
  return 0;
}
