#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  unsigned long long n, second;
  cin >> n >> second;
  unsigned long long lo = 1, hi = n, mid, sum = 0, in = 0;
  while (lo <= hi) {
    mid = lo + (hi - lo) / 2;
    sum = 0;
    for (unsigned long long j = mid; j != 0; j /= 10) sum += j % 10;
    if (mid - sum >= second)
      in = mid, hi = mid - 1;
    else
      lo = mid + 1;
  }
  if (in == 0)
    cout << 0;
  else
    cout << n - in + 1;
  return 0;
}
