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