#include <bits/stdc++.h>
using namespace std;
int main() {
  ifstream in("input.txt");
  ofstream out("output.txt");
  int T = 1;
  for (int t = 0; t < T; t++) {
    long long a, b;
    deque<long long> res;
    cin >> a >> b;
    long long tempA = a, tempB = b;
    while (tempA != 0 && tempB != 0) {
      long long value = 10 - (9 - (tempA % 10));
      if (tempA % 10 == 9) value = 0;
      if (value <= tempB) {
        res.push_front(9);
        tempB -= value;
        tempA -= value;
      } else
        res.push_front(tempA % 10);
      tempA /= 10;
      tempB /= 10;
    }
    while (tempA != 0) {
      res.push_front(tempA % 10);
      tempA /= 10;
    }
    for (int i = 0; i < res.size(); i++) cout << res[i];
  }
}
