#include <bits/stdc++.h>
using namespace std;
string ans;
long long d, x;
void check(string s) {
  long long val, i;
  val = 0;
  for (i = 0; i < s.length(); i++) val = val * 10 + (char)(s[i] - '0');
  if ((x - val <= d) && (x - val >= 0)) ans = s;
}
int main() {
  long long i, j, flag;
  string s;
  x = 0;
  cin >> s >> d;
  ans = s;
  for (i = 0; i < s.length(); i++) x = x * 10 + (char)(s[i] - '0');
  while (1) {
    flag = 0;
    for (i = s.length() - 1; i >= 0; i--) {
      if (s[i] != '9') break;
      if (i == 0) flag = 1;
    }
    s[i] = '9';
    for (j = i - 1; j >= 0; j--) {
      if (s[j] == '0')
        s[j] = '9';
      else {
        s[j]--;
        break;
      }
    }
    check(s);
    if (s[0] == '0') s.erase(s.begin());
    if (flag == 1) {
      break;
    }
  }
  cout << ans << endl;
  cin.get();
  cin.get();
}
