#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long long s1 = 0, s2, s3, p;
  int i, j;
  cin >> s >> p;
  for (i = 0; i < s.length(); i++) s1 = s1 * 10 + s[i] - '0';
  s3 = s1;
  for (i = s.length() - 1; i > 0; i--) {
    if (s[i] != '9') s[i] = '9', s[i - 1]--;
    j = i - 1;
    while (s[j] < '0' && j > 0) s[j] = '9', j--, s[j]--;
    s2 = 0;
    for (j = 0; j < s.length(); j++) s2 = s2 * 10 + s[j] - '0';
    if (s1 - s2 <= p) s3 = s2;
  }
  cout << s3;
  return 0;
}
