#include <bits/stdc++.h>
using namespace std;
long long res;
long long calu(string str) {
  long long tmp = 0;
  for (int i = (int)str.length() - 1; i >= 0; i--)
    tmp = tmp * 10 + (str[i] - '0');
  return tmp;
}
void fun(int cnt, long long p, long long d) {
  string tmp;
  long long rec = p;
  bool flag = 0;
  for (int i = 0; i < cnt; i++) {
    tmp += '9';
    if ((p % 10) < 9) flag = 1;
    if (p)
      p /= 10;
    else
      return;
  }
  if (flag) p--;
  while (p) {
    tmp += (p % 10) + '0';
    p /= 10;
  }
  long long num = calu(tmp);
  if (rec > num && rec - num <= d) {
    res = num;
  }
}
int main() {
  long long p, d;
  cin >> p >> d;
  long long tmp = p;
  int cnt = 0;
  while (tmp) {
    tmp /= 10;
    cnt++;
  }
  res = p;
  for (int i = 1; i < cnt; i++) {
    fun(i, p, d);
  }
  cout << res << endl;
}
