#include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true) {}
long long n, s;
bool check(long long x) {
  long long sum = 0;
  long long tmp = x;
  while (tmp) {
    sum += tmp % 10;
    tmp /= 10;
  }
  return (x - s >= sum);
}
int main() {
  cin >> n >> s;
  long long l = 0, r = n + 10;
  long long ans = (1ll << 62);
  int counter = 0;
  while (l < r) {
    long long mid = (l + r) / 2;
    if (check(mid)) {
      ans = mid;
      r = mid;
    } else
      l = mid + 1;
  }
  if (ans <= n) {
    cout << (n - ans + 1) << '\n';
  } else
    cout << 0 << '\n';
  return 0;
}
