#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e6 + 7;
const int Inf = 1e9 + 7;
int main() {
  long long p, d;
  while (~scanf(" %lld %lld", &p, &d)) {
    long long dp = 1, Mod = 10;
    long long cc = 0;
    long long ans = p;
    long long ss = 1LL;
    for (; Mod <= p; Mod *= 10) {
      if (p % Mod + 1 == Mod) continue;
      if (p % Mod + 1 <= d) {
        cc = p % Mod + 1;
      } else
        break;
      dp++;
    }
    printf("%lld\n", p - cc);
  }
}
