#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, s, l, i, j, k, r, p, m;
  cin >> n >> s;
  if (s >= n)
    cout << 0 << endl;
  else {
    k = s;
    while (1) {
      if (k > n) break;
      long long sum = 0;
      r = k;
      while (r) {
        sum += (r % 10);
        r /= 10;
      }
      if (k - sum >= s) break;
      k++;
    }
    if (k > n)
      cout << 0 << endl;
    else
      cout << n - k + 1 << endl;
  }
  return 0;
}
