#include <bits/stdc++.h>
using namespace std;
int sumofdig(long long n) {
  int sum = 0;
  long long temp = n;
  while (temp > 0) {
    sum += (temp % 10);
    temp /= 10;
  }
  return sum;
}
int main() {
  std::ios::sync_with_stdio(false);
  ;
  long long n, s;
  std::cin >> n >> s;
  long long lo = 1, hi = n;
  long long ans = -1;
  while (lo <= hi) {
    long long mid = (lo + hi) / 2;
    if (mid - sumofdig(mid) >= s) {
      ans = mid;
      hi = mid - 1;
    } else {
      lo = mid + 1;
    }
  }
  if (ans != -1)
    std::cout << n - ans + 1 << endl;
  else
    std::cout << 0;
  return 0;
}
