#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long substractSum(long long x) {
  long long sum = 0;
  long long ans = x;
  while (ans) {
    sum += ans % 10;
    ans /= 10;
  }
  return (x - sum);
}
int main() {
  cin >> n >> k;
  long long lo = 0;
  long long hi = 2e18;
  while ((hi - lo) > 1) {
    long long mid = (lo + hi) / 2;
    if (substractSum(mid) >= k) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  cout << max(n - lo, 0ll) << "\n";
}
