#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long p, d;
  cin >> p >> d;
  long long i = 1, num = 0, x, ans = p;
  for (int k = 0; k <= 18; k++) {
    if (p < num) break;
    x = (p - num) / i;
    if (x * i + num >= p - d) ans = x * i + num;
    i *= 10;
    num = 10 * num + 9;
  }
  cout << ans;
  return 0;
}
