#include <bits/stdc++.h>
using namespace std;
long long getsum(long long nums) {
  string str = to_string(nums);
  long long res = 0;
  for (int i = 0; i < str.size(); i++) {
    res += str[i] - '0';
  }
  return res;
}
int main() {
  long long n, s;
  cin >> n >> s;
  long long cur = s;
  while (cur < n && cur - getsum(cur) < s) {
    cur++;
  }
  cout << max((long long)0,
              n - cur + (cur <= n && cur - getsum(cur) >= s ? 1 : 0));
  return 0;
}
