#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int MAX = 100000;
struct dbg {
  template <typename T>
  dbg& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
  ~dbg() { cerr << endl; }
};
long long p, d;
long long solve() {
  long long pow10 = 1, no = p, diff, prev = 0, minp = p - d, ans1 = p;
  while (no) {
    diff = (no + 1) % 10;
    no -= diff;
    if (no * pow10 + prev < minp) break;
    no /= 10;
    prev = prev * 10 + 9;
    pow10 *= 10;
    ans1 = no * pow10 + prev;
    dbg(), ans1, no, diff, prev;
  }
  int ans2 = no * pow10 + prev;
  if (no == 0 && ans2 < p && ans2 >= minp) {
    ans1 = ans2;
  }
  return ans1;
}
int main(int argc, char* argv[]) {
  cin >> p >> d;
  cout << solve() << endl;
  return 0;
}
