#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  long long k;
  cin >> n >> k;
  long long diff = n - k;
  int dig1 = 0;
  int dig2 = 0;
  long long mul[18];
  mul[0] = 1;
  for (int i = 1; i < 18; i++) {
    mul[i] = mul[i - 1] * 10;
  }
  long long copy = n;
  while (copy != 0) {
    copy = copy / 10;
    dig1++;
  }
  int a[dig1];
  memset(a, 0, sizeof(a));
  int i = 0;
  long long copy1 = diff;
  while (copy1 != 0) {
    a[i] = copy1 % 10;
    i++;
    copy1 = copy1 / 10;
  }
  copy1 = diff;
  for (i = 0; i < 18; i++) {
    copy1 = copy1 + (9 - a[i]) * mul[i];
    if (copy1 > n) {
      copy1 = copy1 - (9 - a[i]) * mul[i];
      break;
    }
    if (copy1 == n) {
      break;
    }
  }
  while (copy1 <= n) {
    copy1 = copy1 + mul[i];
  }
  copy1 = copy1 - mul[i];
  cout << copy1 << endl;
  return 0;
}
