#include <bits/stdc++.h>
long long get(long long num) {
  long long d = 0;
  long long temp = num;
  while (temp) {
    d += temp % 10;
    temp /= 10;
  }
  return num - d;
}
int main() {
  long long n, s;
  while (~scanf("%I64d%I64d", &n, &s)) {
    long long l = 0, r = n;
    long long mid, i = 0;
    while (l <= r) {
      mid = (l + r) / 2;
      long long temp = get(mid);
      if (temp >= s)
        r = mid - 1;
      else if (temp < s)
        l = mid + 1;
    }
    long long temp = get(l);
    if (temp < s) {
      printf("0\n");
    } else {
      printf("%I64d\n", n - l + 1);
    }
  }
}
