#include <bits/stdc++.h>
using namespace std;
long long n, d, ans, s = 1, low;
int main() {
  cin >> n >> d;
  n++;
  low = n - d;
  ans = n;
  while (n >= low) {
    while (n % (10 * s)) n -= s;
    if (n >= low) ans = n;
    s *= 10;
  }
  cout << ans - 1 << endl;
  return 0;
}
