#include <bits/stdc++.h>
using namespace std;
pair<long long int, long long int> find(long long int n) {
  string x = to_string(n);
  pair<long long int, long long int> ans = {-1, -1};
  for (int i = x.size() - 1; i >= 0; i--) {
    if (x[i] != '9') {
      ans = {i, x[i] - '0'};
      break;
    }
  }
  return ans;
}
void solve() {
  long long int num, sum;
  cin >> num >> sum;
  long long int n = to_string(num).size();
  while (num > 0 && sum > 0) {
    pair<long long int, long long int> non_9_ind = find(num);
    if (non_9_ind.first == -1)
      break;
    else {
      long long int subs = (long long int)pow(10, n - 1 - non_9_ind.first) *
                           (non_9_ind.second + 1);
      if (subs > sum)
        break;
      else {
        num -= subs;
        sum -= subs;
      }
    }
  }
  cout << num;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
}
