#include <bits/stdc++.h>
using namespace std;
bool bin(long long int mid, long long int s) {
  string z = to_string(mid);
  long long int sum = 0;
  for (long long int i = 0; i < z.length(); ++i) {
    sum += (z[i] - '0');
  }
  sum = mid - sum;
  if (sum >= s) return true;
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int n, s;
  cin >> n >> s;
  string a = to_string(n);
  long long int sum = 0;
  for (long long int i = 0; i < a.length(); ++i) {
    sum += (a[i] - '0');
  }
  sum = n - sum;
  long long int ans;
  if (sum < s) {
    ans = 0;
  } else {
    long long int lo = 1;
    long long int hi = n;
    while (lo < hi) {
      long long int mid = lo + (hi - lo) / 2;
      if (bin(mid, s))
        hi = mid;
      else
        lo = mid + 1;
    }
    ans = (n - lo) + 1;
  }
  cout << ans;
  return 0;
}
