#include <bits/stdc++.h>
using namespace std;
long long n, s, lo, hi, mid, start;
long long sum_of_digits(long long n) {
  long long sum = 0;
  while (n) sum += n % 10, n /= 10;
  return sum;
}
int main() {
  cin >> n >> s;
  lo = 1;
  hi = 2e18;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    if (mid - sum_of_digits(mid) >= s)
      start = mid, hi = mid - 1;
    else
      lo = mid + 1;
  }
  cout << max(0LL, n - start + 1);
}
