#include <bits/stdc++.h>
using namespace std;
const int mod = 1000003;
long double pi = 3.1415926536;
const int mx = 1000003;
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
long long bp(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
long long p(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return n / i;
    }
  }
  return 1;
}
void solve() {
  long long a, d, x, i = 1;
  cin >> a >> d;
  x = a++;
  while ((a % i) <= d) {
    x = (a - (a % i));
    i *= 10;
  }
  cout << x - 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
