#include <bits/stdc++.h>
using namespace std;
const long long maxx = (1E18);
void solve() {
  long long p, d;
  cin >> p >> d;
  long long k = 1;
  while (1) {
    long long nines = k - 1;
    long long dif = (p - nines) % k;
    if (dif > d || dif < 0) break;
    if (k == maxx) break;
    k *= 10;
  }
  k /= 10;
  long long dif = (p - k + 1) % k;
  long long ans = p - dif;
  cout << ans << endl;
}
int main() { solve(); }
