#include <bits/stdc++.h>
using namespace std;
long long n, s;
bool good(long long x) {
  long long tmp = x;
  long long sm = 0;
  while (tmp) {
    sm += tmp % 10;
    tmp /= 10;
  }
  return x - sm >= s;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> s;
  long long upper = s + 19 * 9;
  long long res = 0;
  if (upper <= n) {
    res = n - upper + 1;
  }
  for (long long i = (s), _i = (min(upper, n + 1)); i < _i; ++i) {
    if (good(i)) res++;
  }
  cout << res << endl;
  return 0;
}
