#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int n_ = 1e5 + 1000;
const long double PI = acos(-1.0);
long long gcd(long long a, long long b) { return (a ? gcd(b % a, a) : b); }
long long power(long long a, long long n) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
    }
    n >>= 1;
    a *= a;
  }
  return p;
}
long long power(long long a, long long n, long long mod) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
      p %= mod;
    }
    n >>= 1;
    a *= a;
    a %= mod;
  }
  return p % mod;
}
bool vowel(char ch) {
  if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long d, p, count = 0, y;
  cin >> p >> d;
  string str = to_string(p);
  for (long long i = str.size() - 1; i >= 0; i--) {
    if (str[i] != '9') break;
    count++;
  }
  y = p;
  for (long long i = 1; i <= 18; i++) {
    long long x = p - p % (power(10, i)) - 1;
    if (p - x > d) break;
    if (i > count) {
      count = i;
      y = x;
    }
  }
  cout << y;
  return 0;
}
