#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int p, d;
  cin >> p >> d;
  long long int base = 1;
  long long int currDiff = 0;
  while (p > base) {
    long long int lastDig = (p / base) % 10;
    if (lastDig != 9) {
      long long int tmpDiff = base * (lastDig + 1);
      currDiff += tmpDiff;
      if (currDiff > d) {
        cout << p;
        return 0;
      }
      p -= tmpDiff;
    }
    base *= 10;
  };
  cout << p;
  return 0;
}
