#include <bits/stdc++.h>
using namespace std;
int main() {
  long long p, d, exp = 1;
  cin >> p >> d;
  int nr_rez = 0;
  while (p > 9 && d >= (p % 10ll + 1ll) * exp) {
    if (p % 10 == 9) {
      nr_rez++;
      exp *= 10;
      p /= 10;
      continue;
    }
    nr_rez++;
    d -= (p % 10ll + 1ll) * exp;
    exp *= 10ll;
    p /= 10;
    p -= 1ll;
  }
  if (p != 0) cout << p;
  for (int i = 0; i < nr_rez; i++) cout << 9;
}
