#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int p, d;
  cin >> p >> d;
  long long int temp = 1;
  long long int po[19];
  for (int i = 0; i <= 18; ++i) {
    po[i] = temp;
    temp *= 10;
  }
  int i = 1;
  temp = p;
  while (1) {
    long long int t = temp % po[i];
    t /= po[i - 1];
    long long int x = temp;
    x -= (t * po[i - 1]);
    x += (9 * po[i - 1]);
    if (p - x >= 0 && p - x <= d) {
      i++;
      temp = x;
      continue;
    }
    if ((p - x + po[i]) <= d && x - po[i] >= 0) {
      x -= po[i];
      temp = x;
      i++;
    } else
      break;
  }
  cout << temp;
}
