#include <bits/stdc++.h>
using namespace std;
long long int sod(long long int n) {
  long long int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main() {
  long long int n, s, count = 0;
  cin >> n >> s;
  long long int mid, low = 0, high = n + 1;
  if (n < s) {
    cout << 0;
    return 0;
  } else {
    for (; low < high;) {
      mid = (low + high) / 2;
      if (mid - sod(mid) >= s)
        high = mid;
      else
        low = mid + 1;
    }
    cout << n - low + 1;
    return 0;
  }
  return 0;
}
