#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7, MAX = 1e5 + 5;
long long powN(long long a, long long p) {
  if (p == 0) return 1;
  long long z = powN(a, p / 2);
  z = (z * z) % MOD;
  if (p % 2) z = (z * a) % MOD;
  return z;
}
vector<bool> is_prime(MAX + 1, true);
void Sieve() {
  is_prime[0] = is_prime[1] = false;
  int i, j;
  for (i = 2; i * i <= MAX; i++) {
    if (is_prime[i]) {
      for (j = i * i; j <= MAX; j += i) is_prime[j] = false;
    }
  }
}
int main() {
  long long p, d;
  cin >> p >> d;
  long long ans = p;
  int how = 0;
  long long xx = p;
  while (xx % 10 == 9) {
    how++;
    xx /= 10;
  }
  for (long long i = 1; i < 18; i++) {
    long long x;
    x = p - p % ((long long)pow(10, i)) - 1;
    if (p - x <= d && x > 0) {
      if (i > how) ans = x;
    }
  }
  cout << ans << endl;
}
