#include <bits/stdc++.h>
using namespace std;
long long n, s;
bool check(long long num) {
  long long sum = 0;
  long long temp = num;
  while (temp) {
    sum += temp % 10;
    temp /= 10;
  }
  return abs(num - sum) >= s;
}
int main() {
  cin >> n >> s;
  long long l = 1;
  long long r = n;
  long long mid = (l + r) >> 1;
  while (l <= r) {
    if (check(mid))
      r = mid - 1;
    else
      l = mid + 1;
    mid = (l + r) >> 1;
  }
  cout << n - l + 1 << endl;
  return 0;
}
