#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
using std::map;
using std::sort;
long long sum_of_digits(long long n) {
  long long res = 0;
  while (n) {
    res += n % 10;
    n = n / 10;
  }
  return res;
}
bool judge(long long x, long long s) {
  if (x - sum_of_digits(x) >= s)
    return true;
  else
    return false;
}
int main() {
  long long n, s;
  cin >> n >> s;
  long long lo = 1, hi = n + 1;
  while (lo < hi) {
    long long mid = lo + hi >> 1;
    if (judge(mid, s)) {
      hi = mid;
    } else {
      lo = mid + 1;
    }
  }
  cout << n + 1 - (hi + lo) / 2 << endl;
  return 0;
}
