#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, s, i, p, cnt, j, sum;
  cin >> n >> s;
  p = s + 19 * 9;
  if (n <= p) p = n;
  cnt = 0;
  for (i = s + 1; i <= p; i++) {
    j = i;
    sum = 0;
    while (j > 0) {
      sum += j % 10;
      j /= 10;
    }
    if (i - sum >= s) cnt++;
  }
  cout << cnt + n - p << endl;
  return 0;
}
