#include <bits/stdc++.h>
using namespace std;
long long int n, l, r, s, mid, Ti;
bool flag = 0;
long long int sumDigit(long long int x) {
  long long int ans = 0;
  while (x) ans += x % 10, x /= 10;
  return ans;
}
int main() {
  cin >> n >> s;
  l = 1, r = n;
  while (l <= r) {
    mid = (l + r) / 2;
    if (mid - sumDigit(mid) >= s) {
      Ti = mid;
      flag = 1;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  if (flag)
    cout << n - Ti + 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}
