#include <bits/stdc++.h>
using namespace std;
long long n, p, tmp, power = 10, need;
char s[20];
int main(int argc, char **argv) {
  scanf("%lld%lld", &n, &p);
  int i, k = 0, l = 0;
  tmp = n;
  while (tmp) {
    s[l] = tmp % 10 + '0';
    tmp /= 10;
    ++l;
  }
  reverse(s, s + l);
  for (k = 1; k <= l; ++k) {
    need = (n % power + 1) % power;
    if (need > p) break;
    if (k < l) power *= 10;
  }
  if (k > l) {
    if (need % power) {
      --s[0];
      for (int i = 1; i < l; ++i) s[i] = '9';
    }
  } else if (k - 1) {
    --k;
    power /= 10;
    if ((n % power + 1) % power) {
      for (i = l - 1; i >= 0 && k; --i, --k) s[i] = '9';
      if (i >= 0) --s[i];
    }
  }
  i = 0;
  while (i < l && s[i] == '0') ++i;
  while (i < l) putchar(s[i++]);
  return 0;
}
