#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long n, copyn, m, copym;
  cin >> n >> m;
  unsigned long long mul = 0;
  copyn = n;
  copym = m;
  while (copyn != 0) {
    unsigned long long temp = pow(10, mul);
    unsigned long long posval = copyn % 10;
    copyn /= 10;
    mul++;
    if (posval == 9)
      continue;
    else {
      unsigned long long minusval = (posval + 1) * temp;
      if (minusval <= copym) {
        copym -= minusval;
        n -= minusval;
      } else {
        break;
      }
    }
    copyn = n / (temp * 10);
  }
  cout << n;
}
