#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n, s;
  cin >> n >> s;
  long long ans = n - s + 1;
  auto f = [&](long long x) {
    long long ret = 0;
    while (x) {
      ret += x % 10;
      x /= 10;
    }
    return ret;
  };
  for (long long i = 0; i < 100000; i++) {
    long long x = i + s;
    if (x > n) break;
    ans -= x - f(x) < s;
  }
  if (ans < 0) ans = 0;
  cout << ans << '\n';
}
