#include <bits/stdc++.h>
using namespace std;
long long n, p, diff = 0, need = 0, power = 1;
int main(int argc, char **argv) {
  scanf("%lld%lld\n", &n, &p);
  while (diff <= p) {
    if (power * 10 > n) break;
    need = 9 - (n % (power * 10)) / power;
    need = (10 - need) % 10;
    need *= power;
    if (diff + need > p) break;
    n -= need;
    diff += need;
    power *= 10;
  }
  printf("%lld", n);
  return 0;
}
