#include <bits/stdc++.h>
using namespace std;
bool sieve[100007];
void sieve_make() {
  memset(sieve, true, sizeof(sieve));
  sieve[0] = sieve[1] = false;
  for (int i = 2; i * i <= 100006; i++) {
    if (sieve[i]) {
      for (int j = 2 * i; j <= 100006; j += i) sieve[j] = false;
    }
  }
}
long long modexp(int a, int b, int c) {
  if (a == 0) return 0;
  if (b == 0) return 1;
  long long ans;
  if (b % 2 == 0) {
    long long small = modexp(a, b / 2, c);
    ans = (small * small) % c;
  } else {
    long long small = modexp(a, b - 1, c);
    ans = (a % c);
    ans = (small * ans) % c;
  }
  return (ans + c) % c;
}
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  long long p, d;
  cin >> p >> d;
  int dig = 0;
  long long t = p, nines = 0;
  while (t) {
    dig++;
    t /= 10;
  }
  t = p;
  while (t) {
    if (t % 10 == 9)
      nines++;
    else
      break;
    t /= 10;
  }
  cerr << dig;
  long long diff = p - d;
  long long val, power;
  for (int k = dig; k >= 1; k--) {
    power = pow(10, k);
    val = (p % power);
    if (p - val - 1 >= diff) {
      long long a = p - val - 1;
      int cnt = 0;
      while (a) {
        if (a % 10 == 9)
          cnt++;
        else
          break;
        a /= 10;
      }
      if (cnt > nines)
        cout << p - val - 1 << '\n';
      else
        break;
      return 0;
    }
  }
  cout << p << '\n';
}
