#include <bits/stdc++.h>
using namespace std;
const int MAX_INT = INT32_MAX;
const long long MAX_LL = INT64_MAX;
const long long mod = 1e9 + 7;
const int N = 1;
const long double pi = 3.14159265359;
bool primes[N + 1];
int npr(int n, int r) {
  int res = 1;
  for (auto i = n - r + 1; i <= n; i++) res *= i;
  return res;
}
int ncr(int n, int r) {
  int res = 1;
  int rFact = 1;
  for (auto i = n - r + 1; i <= n; i++) {
    res *= i;
    if (res % rFact == 0 && rFact <= r) res /= rFact, rFact++;
  }
  return res;
}
void sieve() {
  memset(primes, true, sizeof(primes));
  primes[0] = primes[1] = false;
  for (int i = 2; i * i <= N; i++) {
    if (primes[i]) {
      for (int j = i * i; j <= N; j += i) primes[j] = false;
    }
  }
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n == 2) return true;
  for (auto i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
set<long long> getDivisors(long long val) {
  set<long long> st;
  for (auto i = 1; i <= sqrt(val); i++)
    if (val % i == 0) st.insert(i), st.insert(val / i);
  return st;
}
long long fastPow(long long base, long long power) {
  long long res = 1;
  while (power > 0) {
    if (power % 2 != 0) res = (res * base) % mod;
    base = (base * base) % mod;
    power /= 2;
  }
  return res;
}
bool palindrome(const string& s) {
  string reversedS = s;
  reverse(reversedS.begin(), reversedS.end());
  if (s == reversedS)
    return true;
  else
    return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string p, s;
  cin >> p;
  long long d;
  cin >> d;
  for (auto i = 1; i < p.size(); i++) {
    if (p[i] != '9') {
      break;
    } else if (i == p.size() - 1 && p[i] == '9') {
      cout << p;
      return 0;
    }
  }
  if (p.size() == 1) {
    cout << p;
    return 0;
  }
  for (auto i = 0; i < p.size(); i++) {
    string cur = s;
    if (p[i] == '0') {
      s += p[i];
      continue;
    } else if (i == p.size() - 1)
      continue;
    else if (p[i] == '1' && !i) {
      for (auto j = 0; j < p.size() - 1; j++) cur += '9';
      if (stoll(p) - stoll(cur) <= d) {
        cout << cur;
        return 0;
      }
    } else {
      cur += p[i] - 1;
      for (auto j = i + 1; j < p.size(); j++) cur += '9';
      if (stoll(p) - stoll(cur) <= d) {
        cout << cur;
        return 0;
      }
    }
    s += p[i];
  }
  cout << p << endl;
  return 0;
}
