#include <bits/stdc++.h>
using namespace std;
const double pi = 3.1415926536;
const long long INF = 1e18;
const int32_t M = 1e6 + 7;
const int32_t MM = 998244353;
long long n, d, k = 10, x, t, c = 0, pc = 0, ans, tt;
void solve() {
  cin >> n >> d;
  long long p = n;
  x = p;
  tt = x;
  while (tt > 0) {
    if (tt % 10 == 9)
      pc++;
    else
      break;
    tt /= 10;
  }
  ans = x;
  while (1) {
    if (p % k + 1 > d) break;
    x = p - p % k - 1;
    t = x;
    c = 0;
    while (t > 0) {
      if (t % 10 == 9)
        c++;
      else
        break;
      t /= 10;
    }
    if (c > pc) {
      ans = x;
      pc = c;
    }
    k *= 10;
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) solve();
  return 0;
}
