#include <bits/stdc++.h>
using namespace std;
const int dy[] = {0, -1, 0, 1};
const int dx[] = {1, 0, -1, 0};
const double EPS = 1e-9;
const int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int daysleap[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
long long pp(long long x, long long n) {
  long long ret = 1;
  for (int i = 0; i < n; i++) {
    ret *= x;
  }
  return ret;
}
int main() {
  long long p, d;
  cin >> p >> d;
  vector<long long> m;
  vector<long long> ret;
  for (int i = 1; i < 20 and pp(10, i) <= p; i++) {
    long long po = pp(10, i);
    long long rest = p % po;
    m.push_back(rest + 1);
    if (rest + 1 <= d) {
      ret.push_back(p - (rest + 1));
    }
  }
  ret.push_back(p);
  string out;
  sort(ret.begin(), ret.end());
  int maxn = -1;
  for (typeof(ret.begin()) r = ret.begin(); r != ret.end(); ++r) {
    stringstream ss;
    ss << *r;
    string s;
    ss >> s;
    int n = 0;
    for (int i = s.size() - 1; i >= 0; i--) {
      if (s[i] != '9') break;
      n++;
    }
    if (n >= maxn) {
      maxn = n;
      out = s;
    }
  }
  cout << out << endl;
  return 0;
}
