#include <bits/stdc++.h>
long long n, s;
long long mabs(long long t) { return t >= 0 ? t : -t; }
bool meet(long long t) {
  int sum = 0;
  long long tt = t;
  while (t != 0) {
    sum += t % 10;
    t /= 10;
  }
  if (mabs(tt - sum) >= s) return 1;
  return 0;
}
int main() {
  scanf("%I64d %I64d", &n, &s);
  long long l = 1, r = n;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (meet(mid))
      r = mid - 1;
    else
      l = mid + 1;
  }
  while (!meet(r)) r++;
  while (meet(r - 1)) r--;
  printf("%I64d\n", n - r + 1 > 0 ? n - r + 1 : 0);
  return 0;
}
