#include <bits/stdc++.h>
using namespace std;
long long int dig(long long int x) {
  long long int res = 0;
  while (x) {
    res += x % 10;
    x /= 10;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, s;
  cin >> n >> s;
  long long int l = 0, r = n, ans = n, mid, x;
  while (l <= r) {
    mid = l + (r - l) / 2;
    x = mid - dig(mid);
    if (x >= s) {
      r = mid - 1;
      ans = mid - 1;
    } else
      l = mid + 1;
  }
  cout << n - ans;
}
