#include <bits/stdc++.h>
using namespace std;
int main() {
  long long p, d;
  cin >> p >> d;
  long long n = ++p;
  for (long long k = 10;; k *= 10) {
    if (p % k > d) break;
    n = p - (p % k);
  }
  cout << n - 1;
}
