#include <bits/stdc++.h>
using namespace std;
unsigned long long d, p, mt = 1;
int l = 1;
void di(unsigned long long &p) {
  unsigned long long c, mm = mt, pp = p;
  l = 0;
  while (mm != 1) {
    pp /= 10;
    mm /= 10;
  }
  c = pp % 10;
  if (c == 9) l = 1;
  if ((c + 1) * mt <= d && c != 9) {
    l = 1;
    p -= (c + 1) * mt;
    d -= (c + 1) * mt;
  }
}
int main() {
  cin >> p >> d;
  while (l) {
    di(p), mt *= 10;
  }
  cout << p << endl;
  return 0;
}
