#include <bits/stdc++.h>
using namespace std;
bool check(long long n, long long s) {
  long long sum = 0;
  long long t = n;
  while (t > 0) {
    sum += t % 10;
    t /= 10;
  }
  return n - sum >= s;
}
int main() {
  long long n, s;
  cin >> n >> s;
  long long count = 0;
  count = 0;
  for (long long i = s; i <= s + 200 && i <= n; i++) {
    if (check(i, s)) count++;
  }
  if (n >= s + 200) {
    count += (n - s - 200);
  }
  cout << count;
  return 0;
}
