#include <bits/stdc++.h>
using namespace std;
long long digit(long long s) {
  long long sum = 0;
  while (s != 0) {
    long long a;
    a = s % 10;
    s = s / 10;
    sum += a;
  }
  return sum;
}
int main() {
  long long n, s;
  cin >> n >> s;
  long long i, x, ans;
  for (i = s; i <= s + 1000; i++) {
    x = digit(i);
    if (i - x >= s) break;
  }
  ans = n - i + 1;
  if (ans < 0 || n == s)
    cout << "0";
  else
    cout << ans;
  return 0;
}
