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