#include <bits/stdc++.h>
using namespace std;
long long p, d, q, fin;
int main() {
  cin >> p >> d;
  long long t = 1ll;
  for (int i = 0; i <= 18; i++) {
    if (p % t == t - 1)
      fin = p;
    else {
      q = p / t * t - 1;
      if (p - q > d)
        break;
      else
        fin = q;
    }
    t *= 10ll;
  }
  cout << fin << endl;
  return 0;
}
