#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int p, d, q, num1, num2, x = 0, digit1 = 0, digit2 = 0;
  cin >> p >> d;
  num1 = p, num2 = p - d;
  while (p % 10 == 9) {
    x++;
    p /= 10;
  }
  p = num1;
  q = p - d;
  while (p > 0 || q > 0) {
    if (p > 0) digit1++;
    if (q > 0) digit2++;
    p /= 10;
    q /= 10;
  }
  int a[digit1], b[digit2];
  p = num1, q = num2;
  for (int i = digit1 - 1; i >= 0; i--) {
    a[i] = p % 10;
    p /= 10;
  }
  for (int i = digit2 - 1; i >= 0; i--) {
    b[i] = q % 10;
    q /= 10;
  }
  if (digit1 == x)
    cout << num1;
  else if (x == digit1 - 1)
    cout << num1;
  else if (digit2 < digit1) {
    if (a[0] != 1) cout << a[0] - 1;
    for (int i = 0; i < digit1 - 1; i++) cout << "9";
  } else {
    for (int i = 0; i < digit1; i++) {
      x = i + 1;
      if (a[i] == b[i])
        cout << a[i];
      else {
        if (i != digit1 - 1)
          cout << a[i] - 1;
        else
          cout << a[i];
        break;
      }
    }
    for (int i = x; i < digit1; i++) cout << "9";
  }
}
