#include <bits/stdc++.h>
using namespace std;
long long n, i, cur, ndig, d, stNine, ans, a;
long long nDig(long long a) {
  int i;
  i = 0;
  while (a > 0) {
    a /= 10;
    i++;
  }
  return i;
}
long long Nnine(long long a) {
  int i, k;
  i = 0;
  while (a > 0) {
    k = a;
    k %= 10;
    if (k == 9) i++;
    if (k != 9) break;
    a /= 10;
  }
  return i;
}
long long stepTen(long long a) {
  long long i, b;
  b = 1;
  for (i = 1; i <= a; i++) b *= 10;
  return b;
}
int main() {
  cin >> n >> d;
  ndig = nDig(n);
  stNine = Nnine(n);
  ans = n;
  for (i = stNine; i <= ndig; i++) {
    a = stepTen(i + 1);
    if ((n % a) + 1 <= d) ans = n - (n % a) - 1;
  }
  cout << ans;
}
