#include <bits/stdc++.h>
using namespace std;
long long a, b;
bool check(long long mid) {
  long long temp = mid;
  long long tot = 0;
  while (temp) {
    tot = tot + temp % 10LL;
    temp /= 10LL;
  }
  if (mid - tot >= b)
    return true;
  else
    return false;
}
int main() {
  while (~scanf("%lld %lld", &a, &b)) {
    long long l = 1LL, r = a;
    long long ans = 1LL << 60;
    while (l <= r) {
      long long mid = (l + r) >> 1;
      if (check(mid))
        ans = mid, r = mid - 1;
      else
        l = mid + 1;
    }
    printf("%lld\n", max(a - ans + 1, 0LL));
  }
  return 0;
}
