#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, z;
  cin >> n >> z;
  string temp;
  long long int h = n, c = 0;
  bool flag = 1;
  while (n > 0) {
    temp += ((n % 10) + 48);
    if (n % 10 == 9 && flag) {
      c++;
    } else
      flag = 0;
    n /= 10;
  }
  if (c == temp.size()) {
    cout << h << endl;
    return 0;
  }
  reverse(temp.begin(), temp.end());
  long long int s = 0;
  int index = 0;
  long long int c2 = 0;
  bool flag2 = 0;
  for (int i = 0; i < temp.size() - 1; i++) {
    string k = temp;
    c2 = 0;
    if (k[i] == '0') continue;
    k[i]--;
    for (int j = i + 1; j < temp.size(); j++) {
      k[j] = '9';
      c2++;
    }
    s = 0;
    for (int j = 0; j < temp.size(); j++) {
      s += (k[j] - 48);
      if (j != temp.size() - 1) s *= 10;
    }
    if (h - z <= s) {
      flag2 = 1;
      break;
    }
  }
  if (!flag2) {
    cout << h << endl;
  } else if (c2 > c) {
    cout << s << endl;
  } else
    cout << h << endl;
}
