#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long p, d;
  cin >> p >> d;
  long long ans = p;
  long long k = p - d;
  long long t = 1, h = p;
  while (p) {
    if (h % 10 == 9) {
      t *= 10;
    } else {
      break;
    }
    h /= 10;
  }
  t *= 10;
  for (int i = 0; i < 18; i++) {
    long long tmp = p - (p % t) - 1;
    if (tmp != -1 && tmp >= k) {
      ans = tmp;
      t *= 10;
    } else {
      cout << ans << endl;
      return;
    }
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
