#include <bits/stdc++.h>
using namespace std;
long long n, s;
long long f(long long x) {
  long long res = 0;
  long long tmp = x;
  while (x > 0) {
    res += x % 10;
    x /= 10;
  }
  return tmp - res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  if (f(n) < s)
    cout << 0 << '\n';
  else {
    long long lo = 1, hi = n;
    long long ans = n;
    while (lo <= hi) {
      long long mid = (lo + hi) >> 1;
      if (f(mid) >= s) {
        ans = mid;
        hi = mid - 1;
      } else
        lo = mid + 1;
    }
    cout << n - ans + 1 << '\n';
  }
  return 0;
}
