#include <bits/stdc++.h>
using namespace std;
int main() {
  long long p, d, i, j, tmp, res;
  cin >> p >> d;
  res = p;
  for (i = 999999999999999999ll; i; i /= 10) {
    j = i + 1;
    if (i > p) continue;
    if (i == p) break;
    if (p % j == i) {
      tmp = (p / j) * j + i;
      if (p - tmp <= d) {
        res = tmp;
        break;
      }
    } else {
      tmp = (p / j - 1) * j + i;
      if (p - tmp <= d) {
        res = tmp;
        break;
      }
    }
  }
  cout << res << endl;
  return 0;
}
