#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, s;
  cin >> n >> s;
  auto ok = [&](long long y) -> bool {
    long long original = y;
    long long sum = 0;
    while (y > 0) {
      sum += y % 10;
      y /= 10;
    }
    return abs(original - sum) >= s;
  };
  long long l = 0, r = n;
  while (l < r) {
    long long mid = l + (r - l + 1) / 2;
    if (!ok(mid)) {
      l = mid;
    } else {
      r = mid - 1;
    }
  }
  cout << max(0LL, n - l) << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  solve();
  return 0;
}
