#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long MAX = 1e17;
long long n, s;
long long sumofdigits(long long x) {
  long long ans = 0;
  while (x != 0) {
    ans += x % 10;
    x = x / 10;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  ;
  cin >> n >> s;
  long long h = s;
  while (h - sumofdigits(h) < s) {
    h++;
  }
  if (h > n)
    cout << 0 << endl;
  else
    cout << n - h + 1 << endl;
  return 0;
}
