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