#include <bits/stdc++.h>
using namespace std;
int nu[30];
long long ch() {
  long long q = 0, m = 1;
  for (int i = 19; i >= 1; --i) {
    if (nu[i] == 0 && m == 1)
      continue;
    else {
      m = 0;
      q *= 10;
      q += nu[i];
    }
  }
  return q;
}
int fi() {
  int num = 0;
  for (int i = 19; i >= 0; --i) {
    if (nu[i] == 9)
      num++;
    else {
      break;
    }
  }
  return num;
}
int main() {
  int i, j, k;
  for (i = 1; i <= 20; ++i) nu[i] = 0;
  long long we;
  for (long long a, b; cin >> a >> b;) {
    if (!cin) break;
    long long an, t = a, m = 0, w, y = 0;
    int num = 0;
    for (i = 1; i <= 19; ++i) {
      nu[i] = t % 10;
      t /= 10;
    }
    for (i = 1; i <= 20; ++i) {
      if (nu[i] == 9)
        num++;
      else
        break;
    }
    an = num;
    we = a;
    for (i = num + 1; i <= 20; ++i) {
      w = ch();
      if (nu[19] > 1 || w > a) {
        break;
      }
      nu[i] = 9;
      nu[i + 1]--;
      if (nu[i + 1] < 0) continue;
      if (a - ch() <= b) we = ch();
    }
    cout << we << endl;
  }
  return 0;
}
