#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
template <typename T>
string num2str(T i) {
  stringstream ss;
  ss << i;
  return ss.str();
}
std::vector<std::string> Split(std::string str, std::string pattern) {
  std::string::size_type pos;
  std::vector<std::string> result;
  str += pattern;
  std::string::size_type size = str.size();
  for (int i = 0; i < size; i++) {
    pos = str.find(pattern, i);
    if (pos < size) {
      std::string s = str.substr(i, pos - i);
      result.push_back(s);
      i = pos + pattern.size() - 1;
    }
  }
  return result;
}
bool IsPrimer(int x) {
  if (x < 2) {
    return false;
  }
  for (int i = 2; i <= sqrt(double(x)); i++) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}
template <typename T>
bool DesCmp(T a, T b) {
  return a > b;
}
template <typename T>
void Swap(T &a, T &b) {
  int temp = a;
  a = b;
  b = temp;
}
template <typename T>
void InputArray(T &a, int n) {
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
}
int main() {
  long long int p, d;
  cin >> p >> d;
  long long int pl = p - d;
  string sp = num2str(p);
  string spl = num2str(pl);
  int ld = sp.size() - spl.size();
  string ans;
  bool change = false;
  int k = 0;
  if (ld > 0) {
    ans += sp[0];
    k = 0;
    for (int i = 1; i < sp.size(); i++) {
      ans += '9';
    }
  } else {
    for (int i = 0; i < sp.size(); i++) {
      if (change) {
        ans += '9';
      } else if (sp[i] == spl[i]) {
        ans += sp[i];
      } else {
        ans += sp[i];
        k = i;
        change = true;
      }
    }
  }
  if (ans.length() == sp.size() && ans > sp) {
    ans[k]--;
  }
  bool ye = false;
  for (int i = 0; i < ans.size(); i++) {
    if (ans[i] != '0' || ye) {
      printf("%c", ans[i]);
      ye = true;
    }
  }
  printf("\n");
  return 0;
}
