#include <bits/stdc++.h>
using namespace std;
long long n, s;
int main() {
  cin >> n >> s;
  long long l, r;
  l = 1, r = n;
  long long sum = 0;
  long long test;
  long long flag = 0;
  while (l <= r) {
    long long mid = (l + r) / 2;
    for (test = mid; test >= 10; test = test / 10)
      sum += test - (test / 10) * 10;
    sum += test;
    if (mid - sum < s) l = mid + 1;
    if (mid - sum >= s) {
      r = mid - 1;
      flag = mid;
    }
    sum = 0;
  }
  if (!flag)
    cout << 0 << endl;
  else
    cout << n - flag + 1 << endl;
  return 0;
}
