#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 5, N = 2e5 + 100, mod = 1e9 + 7, M = 1e6 + 5,
                LOG = 18;
long long sum_digit(long long x) {
  long long res = 0;
  while (x > 0) {
    res += (x % 10);
    x /= 10;
  }
  return res;
}
int main() {
  long long n, s;
  cin >> n >> s;
  long long l = 1, r = n, ans = n + 1;
  while (l <= r) {
    long long mid = (l + r) / 2ll;
    if (mid - sum_digit(mid) >= s) {
      ans = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  cout << n - ans + 1 << endl;
}
