#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x = 0, cnt = 0, p, d, l, u;
  cin >> p >> d;
  l = p - d;
  u = p;
  long long mx = 0, mp;
  for (long long i = 0; i <= 18 && x <= u; i++) {
    long long px = (u - x) / (x + 1);
    long long dx = (l - x) / (x + 1);
    long long r = (l - x) % (x + 1);
    if (r > 0)
      dx++;
    else if (r < 0)
      dx--;
    if (px >= dx) {
      mx = x;
      mp = x + px * (x + 1);
    }
    x *= 10;
    x += 9;
  }
  cout << mp << endl;
  return 0;
}
