#include <bits/stdc++.h>
using namespace std;
int main() {
  long long p, d;
  cin >> p >> d;
  long long mul = 1, sum = 0;
  long long val = p;
  vector<long long> v;
  while (p) {
    long long rem = p % 10;
    v.push_back(rem);
    p = p / 10;
  }
  reverse(v.begin(), v.end());
  for (int i = v.size() - 1; i > 0; i--) {
    if (v[i] == 9) {
      mul *= 10;
      continue;
    }
    long long lagbe = (v[i] + 1) * mul;
    mul *= 10;
    if (lagbe <= d) {
      d -= lagbe;
      sum += lagbe;
      v[i] = 9;
      v[i - 1]--;
    } else
      break;
  }
  cout << val - sum << endl;
}
