#include <bits/stdc++.h>
using namespace std;
int main() {
  long long d, a;
  cin >> a;
  cin >> d;
  a++;
  d++;
  long long k = a - 1LL;
  long long p = 10LL;
  while (true) {
    if (a < p) {
      break;
    }
    long long na = a / p * p - 1LL;
    if (a - na <= d) {
      k = na;
    } else {
      break;
    }
    if (p < 1000000000LL * 1000000000LL) {
      p *= 10LL;
    } else {
      break;
    }
  }
  cout << k << "\n";
  return 0;
}
