#include <bits/stdc++.h>
const double PI = acos(-1.0);
using namespace std;
void cp() {
  long long int p, q, temp, ans;
  int mx = 0;
  cin >> p >> q;
  temp = p;
  ans = p;
  while (temp) {
    if (temp % 10 == 9)
      mx++;
    else
      break;
    temp /= 10;
  }
  long long int m = 10;
  for (int i = 0; i < 18; i++) {
    long long int cur = p - p % m - 1;
    m = m * 10;
    if (cur < 0) continue;
    if (p - cur > q) break;
    temp = cur;
    int cnt = 0;
    while (temp) {
      if (temp % 10 == 9)
        cnt++;
      else
        break;
      temp /= 10;
    }
    if (cnt > mx) mx = cnt, ans = cur;
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  t = 1;
  while (t--) {
    cp();
  }
  return 0;
}
