#include <bits/stdc++.h>
using namespace std;
long long int powers[19];
void getpowers() {
  powers[0] = 0;
  for (int i = 1; i < 19; i++) powers[i] = powers[i - 1] * 10 + 9;
  return;
}
bool cond(long long int n, long long int s) {
  long long int sum = 0, i = 0;
  while (n != 0) {
    sum += powers[i] * (n % 10);
    n = n / 10;
    ++i;
  }
  return (sum >= s);
}
long long int binary(long long int n, long long int s) {
  long long int lo = 1, hi = n;
  while (lo < hi) {
    long long int x = (lo + hi + 1) / 2;
    if (cond(x, s))
      hi = x - 1;
    else
      lo = x;
  }
  return lo;
}
int main() {
  getpowers();
  long long int n, s;
  cin >> n >> s;
  cout << n - binary(n, s) << endl;
  return 0;
}
