#include <bits/stdc++.h>
using namespace std;
long long n, s;
int cal(long long n) {
  int ans = 0;
  long long t = n;
  while (t) {
    ans += t % 10;
    t /= 10;
  }
  return ans;
}
int main() {
  cin >> n >> s;
  long long high = n, low = 1, mid;
  int flag = 0;
  for (int i = 0; i < 100; i++) {
    mid = (low + high) / 2;
    if (mid - cal(mid) >= s)
      high = mid, flag = 1;
    else
      low = mid + 1;
  }
  if (flag)
    cout << n - mid + 1 << endl;
  else
    cout << 0 << endl;
  return 0;
}
