#include <bits/stdc++.h>
using namespace std;
long long n, s;
long long tp(long long k) {
  long to = 0;
  while (k > 0) {
    to += k % 10;
    k /= 10;
  }
  return to;
}
int main() {
  cin >> n >> s;
  long long l = 1, r = n, res = n + 1;
  while (l <= r) {
    long long m = (l + r) / 2;
    if (m - tp(m) >= s) {
      res = m;
      r = m - 1;
    } else
      l = m + 1;
  }
  cout << n - res + 1;
}
