#include <bits/stdc++.h>
using namespace std;
int MAIN() {
  long long x, d, A;
  while (cin >> x >> d) {
    A = x;
    long long mod = 1;
    long long ans = x;
    while (true) {
      while (A >= x - d && (A / mod) % 10 != 9) A -= mod;
      if (A >= x - d)
        ans = A, mod *= 10;
      else
        break;
    }
    cout << ans << endl;
  }
  return 0;
}
int main() {
  ios ::sync_with_stdio(false);
  cout << fixed << setprecision(16);
  return MAIN();
}
