#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int p, d, ten, val, count = 1, a[22];
  cin >> p;
  cin >> d;
  ten = 10;
  a[0] = p;
  while (a[count - 1] >= 0) {
    a[count] = a[count - 1] - (((a[count - 1] % ten) + 1) % ten);
    count++;
    ten *= 10;
  }
  for (int i = (count - 1); i >= 0; i--) {
    if (p - a[i] <= d) {
      cout << a[i] << endl;
      return 0;
    }
  }
  return 0;
}
