#include <bits/stdc++.h>
using namespace std;
long long n, s, k, m, ans;
long long jam(long long x) {
  long long y = 0;
  while (x != 0) {
    y += (x % 10);
    x /= 10;
  }
  return y;
}
int main() {
  cin >> n >> s;
  m = 9 * 18;
  k = min(s + 9, m);
  m = 0;
  for (long long i = s; i <= n; i++) {
    m = jam(i);
    if (i - m >= s) {
      cout << n - i + 1;
      return 0;
    }
  }
  cout << 0;
  return 0;
}
