#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, base[20];
  base[0] = 1;
  for (int i = 0; i < 18; i++) base[i + 1] = base[i] * 10;
  while (cin >> a >> b) {
    long long ans = a, now = a, t = a;
    int c = 0;
    while (a - now <= b) {
      ans = now;
      c++;
      if (t < 10) break;
      if (t % 10 == 9) {
        t /= 10;
        continue;
      }
      t /= 10;
      t--;
      now = base[c] - 1 + base[c] * t;
    }
    cout << ans << endl;
  }
  return 0;
}
