#include <bits/stdc++.h>
using namespace std;
long long n, i, k, l, r, d, ans;
bool f(long long a) {
  long long b = a, sum = 0;
  while (b > 0) {
    sum += b % 10;
    b /= 10;
  }
  return (a - sum >= k);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  l = 1;
  r = n;
  while (l <= r) {
    d = (l + r) / 2;
    if (f(d)) {
      r = d - 1;
      ans = n - d + 1;
    } else
      l = d + 1;
  }
  cout << ans << '\n';
  return 0;
}
