#include <bits/stdc++.h>
using namespace std;
long long licz(long long n) {
  long long tmp = n, cnt = 0;
  while (n) cnt += n % 10, n /= 10;
  return tmp - cnt;
}
int main() {
  long long n, s, a = 0, b = LLONG_MAX / 2 - 5;
  scanf("%lld %lld", &n, &s);
  while (a < b) {
    long long x = (a + b) / 2;
    if (licz(x) < s)
      a = x + 1;
    else
      b = x;
  }
  printf("%lld", max(0LL, n - a + 1));
}
