#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const int mod = 1e9 + 7;
const double pi = acos(-1.0);
long long n, s;
bool fun(long long x) {
  long long sum = 0;
  long long tmp = x;
  while (x) {
    sum += x % 10;
    x /= 10;
  }
  if (tmp - sum >= s)
    return true;
  else
    return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> s;
  long long l = 1;
  long long r = n;
  while (r - l > 4) {
    long long mid = (l + r) / 2;
    if (fun(mid))
      r = mid;
    else
      l = mid;
  }
  for (long long i = l; i <= r; i++) {
    if (fun(i)) {
      cout << n - i + 1 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}
