#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long p, d, tmp;
  cin >> p >> d;
  unsigned long long i = 10;
  unsigned long long mn = p - d;
  p++;
  while (p > mn) {
    tmp = p;
    p -= p % i;
    if (p <= mn) {
      p = tmp;
      break;
    }
    i *= 10;
  }
  cout << p - 1 << endl;
  return 0;
}
