#include <bits/stdc++.h>
using namespace std;
long long n, s;
bool can(long long a) {
  long long d = a, sum = 0;
  while (d) {
    sum += (d % 10);
    d /= 10;
  }
  return a - sum >= s;
}
int main() {
  cin >> n >> s;
  if (!can(n)) {
    cout << 0;
    return 0;
  }
  long long l = 1, h = n, mid;
  while (h - l > 1) {
    mid = (l + h) / 2;
    if (can(mid))
      h = mid;
    else
      l = mid;
  }
  if (can(l))
    cout << n - l + 1;
  else
    cout << n - h + 1;
  return 0;
}
