#include <bits/stdc++.h>
using namespace std;
const int inf = 0;
const double eps = 0;
const int ms = 0;
const int md = 0;
const int MAX_N = 1e5 + 5;
const int MAX_L = 20;
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;
long long mpow(long long k) {
  long long ans = 1;
  while (k > 0) {
    ans *= 10;
    k--;
  }
  return ans;
}
long long countNines(long long n) {
  long long ans = 0;
  while (n > 0) {
    if (n % 10 == 9) {
      ans++;
    } else
      break;
    n /= 10;
  }
  return ans;
}
int main() {
  long long p, d;
  cin >> p >> d;
  int k = 1;
  long long ans = -1;
  while ((p - p % mpow(k) - 1) > 0) {
    if ((p - p % mpow(k) - 1) >= p - d) {
      ans = p - p % mpow(k) - 1;
    }
    k++;
  }
  if (countNines(ans) > countNines(p))
    cout << ans << endl;
  else
    cout << p << endl;
  return 0;
}
