#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  long long p, d;
  cin >> p >> d;
  long long t = p - d;
  while (1) {
    string s;
    long long tt = t;
    while (tt) {
      char c = '0' + tt % 10;
      s += c;
      tt /= 10;
    }
    long long id = 0;
    while (id < s.size() && s[id] == '9') id++;
    if (id == s.size())
      s += '1';
    else
      s[id]++;
    long long ttt = 0;
    for (long long i = s.size() - 1; i >= 0; i--) ttt = ttt * 10 + (s[i] - '0');
    if (ttt <= p)
      t = ttt;
    else
      break;
  }
  cout << t << endl;
  return 0;
}
