#include <bits/stdc++.h>
using namespace std;
long long cur = 1ll, p, d, ans;
int main() {
  cin >> p >> d;
  ans = p;
  for (int i = 1; i < 19; i++) {
    cur *= 10ll;
    if (p >= cur && (p % cur) + 1 <= d) {
      ans = p - p % cur - 1;
      if (ans % cur == p % cur) ans = p;
    }
  }
  cout << ans;
  return 0;
}
