#include <bits/stdc++.h>
const unsigned int M = 1000000007;
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  unsigned long long int p, d;
  cin >> p >> d;
  string s = to_string(p);
  long long y = 10, i = s.size() - 1;
  while (i >= 0) {
    s = to_string(p);
    long long x = s[i] - '0';
    if (x != 9) {
      long long k = (x + 1) * (y / 10);
      if (k <= d && k < p) {
        p = p - k;
        d = d - k;
      } else {
        break;
      }
    }
    y = y * 10;
    i--;
  }
  cout << p;
  return 0;
}
