#include <bits/stdc++.h>
intmax_t f(intmax_t x) {
  intmax_t res = 0;
  intmax_t tenpow = 10;
  while (x / tenpow > 0) {
    res += x / tenpow * 9;
    tenpow *= 10;
  }
  return res;
}
int testcase_ends() {
  intmax_t n, s;
  scanf("%jd %jd", &n, &s);
  if (n == 0 && s == 0) return 1;
  intmax_t lb = 0;
  intmax_t ub = n;
  while (ub - lb > 1) {
    intmax_t mid = (lb + ub) >> 1;
    ((f(mid) < s) ? lb : ub) = mid;
  }
  intmax_t res = n - lb;
  if (f(ub) < s) res = 0;
  printf("%jd\n", res);
  return 0;
}
int main() { testcase_ends(); }
