#include <bits/stdc++.h>
using namespace std;
void Yahia74() {
  ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}
const int N = 3e5 + 74, OO = 0x3f3f3f3f, MOD = (int)1e9 + 7;
int main() {
  Yahia74();
  long long n, d;
  cin >> n >> d;
  long long ans = n, c = 9, t = 10;
  while (c <= n) {
    long long st = 0, ed = 1e18 / t;
    while (st < ed) {
      long long m = st + (ed - st + 1) / 2;
      if (m * t + c <= n)
        st = m;
      else
        ed = m - 1;
    }
    if (st * t + c <= n && st * t + c >= n - d) ans = st * t + c;
    t *= 10;
    c = c * 10 + 9;
  }
  cout << ans << '\n';
  return 0;
}
