#include <bits/stdc++.h>
using namespace std;
bool check(long long n) {
  long long rem;
  while (n != 0) {
    rem = n % 10;
    if (rem != 9) {
      return false;
    }
    n /= 10;
  }
  return true;
}
int main() {
  long long p, d, fr, i;
  double po;
  cin >> p >> d;
  i = 1;
  while (!check(p)) {
    po = pow(10, i);
    fr = p % (long long)po;
    if (fr < po - 1) {
      if (fr + 1 <= d) {
        p -= (fr + 1);
        d -= (fr + 1);
      } else {
        break;
      }
    }
    i++;
  }
  cout << p;
  return 0;
}
