#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
long long M = 1e9 + 7;
long long MOD = 998244353;
const double PI = 3.141592653589793238460;
bitset<N> bs;
long long power(long long a, long long b) {
  long long res = 1;
  for (; b > 0; b >>= 1) {
    if (b & 1) res *= a;
    a *= a;
  }
  return res;
}
int main() {
  unsigned long long x, d;
  cin >> x >> d;
  unsigned long long n = x - d;
  string s1 = to_string(x);
  string s2 = to_string(n);
  string s3 = "";
  int e = s1.length() - s2.length();
  for (int i = 0; i < e; i++) s3.push_back('0');
  s2 = s3 + s2;
  bool flag = false;
  int ind = -1;
  for (int i = 0; i < s1.length(); i++) {
    if (!flag && s1[i] > s2[i]) {
      flag = true;
      ind = i;
    } else if (flag)
      s2[i] = '9';
  }
  for (int i = ind; i >= 0; i--) {
    string s = s2;
    s[i] = '9';
    n = stoull(s);
    if (n <= x) {
      s2 = s;
    } else {
      s2[i] = s1[i];
      if (ind != s1.length() - 1 && s2 != s1) s2[i]--;
      break;
    }
  }
  string ans = "";
  flag = true;
  for (int i = 0; i < s2.length(); i++) {
    if (s2[i] == '0') {
      if (!flag) ans.push_back(s2[i]);
    } else {
      flag = false;
      ans.push_back(s2[i]);
    }
  }
  cout << ans;
}
