#include <bits/stdc++.h>
using namespace std;
long long f(long long a) {
  long long ret = 0;
  while (a) {
    ret += a % 10;
    a /= 10;
  }
  return ret;
}
int main() {
  long long n, s;
  scanf("%lld%lld", &n, &s);
  long long k;
  for (k = s;; k++) {
    if (k - f(k) >= s) break;
  }
  if (k > n)
    printf("0\n");
  else
    printf("%lld\n", n - k + 1);
  return 0;
}
