#include <bits/stdc++.h>
using namespace std;
long long a, b, d, z;
long long c[99];
int main() {
  cin >> a >> d;
  c[0] = 1;
  for (int i = 1; i < 20; i++) c[i] = c[i - 1] * 10;
  b = c[19] - 1;
  z = 18;
  while (z > 0) {
    for (int i = 9; i >= 0; i--) {
      if (b >= a - d && b <= a) {
        cout << b;
        return 0;
      }
      if (b - c[z] >= a - d) b -= c[z];
    }
    z--;
  }
  cout << a;
}
