#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return a % b == 0 ? b : gcd(b, a % b); }
long long P, D;
int getlen(long long x) {
  int len = 0;
  while (x) {
    x /= 10;
    len++;
  }
  return len;
}
long long fac[24];
int main() {
  fac[0] = 1;
  for (int i = 1; i < 24; i++) fac[i] = fac[i - 1] * 10;
  while (cin >> P >> D) {
    int len1 = getlen(P), len2 = getlen(P - D);
    if (P == fac[len1] - 1)
      cout << P << endl;
    else if (len1 > len2) {
      int len = len1;
      if (P % fac[len - 1] == fac[len - 1] - 1)
        cout << P / fac[len - 1];
      else if (P / fac[len - 1] > 1)
        cout << P / fac[len - 1] - 1;
      for (int i = 1; i <= len - 1; i++) cout << 9;
      cout << endl;
    } else {
      long long q = P - D;
      for (int i = 1; i <= len1; i++) {
        if (P / fac[len1 - i] == q / fac[len2 - i])
          cout << P / fac[len1 - i];
        else {
          if (i == len1)
            cout << P;
          else {
            cout << P / fac[len1 - i] - 1;
          }
          for (int j = i + 1; j <= len1; j++) cout << 9;
          cout << endl;
          break;
        }
        P %= fac[len1 - i];
        q %= fac[len1 - i];
      }
    }
  }
  return 0;
}
