#include <bits/stdc++.h>
using namespace std;
long long dig(long long x) {
  long long k = 0;
  while (x > 0) k += (x % 10), x /= 10;
  return k;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t, i, j, n, m, k, l, r;
  cin >> n >> k;
  l = 1, r = n;
  while (l <= r) {
    m = (l + r) / 2;
    if ((m - dig(m)) >= k)
      r = m - 1;
    else
      l = m + 1;
  }
  cout << (n - l + 1) << "\n";
  return 0;
}
