#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, p, d, oron = 0, b, c, x = 0, y = 0;
  cin >> p >> d;
  a = p;
  while (a > 0) {
    oron++;
    if (a % 10 == 9 && x == 0) {
      y++;
    } else
      x++;
    a /= 10;
  }
  if (p == pow(10, oron) - 1) {
    cout << p;
    exit(0);
  }
  oron--;
  while (oron--) {
    if (oron + 1 == y) {
      cout << p;
      exit(0);
    }
    b = p;
    c = oron;
    while (c >= 0) {
      b /= 10;
      c--;
    }
    if (b == 1) {
      x = pow(10, oron + 1) - 1;
      if (p - x <= d) {
        cout << x;
        exit(0);
      }
    }
    b--;
    while (c < oron) {
      b *= 10;
      c++;
    }
    b += pow(10, oron + 1) - 1;
    if (p - b <= d) {
      cout << b;
      exit(0);
    }
  }
  cout << p;
}
