#include <bits/stdc++.h>
int main(int argc, char const *argv[]) {
  unsigned long long int p, d, i, x, continuer = 1, y, a = 0, b = 1;
  char str[100000];
  scanf("%llu%llu", &p, &d);
  x = p - d;
  while (continuer) {
    sprintf(str, "%llu", p);
    for (i = b; i < strlen(str); i++) str[i] = '9';
    y = atoll(str);
    if (y > p) str[a]--;
    y = atoll(str);
    if (y >= x)
      continuer = 0;
    else {
      a++;
      b++;
    }
  }
  printf("%llu\n", y);
  return 0;
}
