#include <bits/stdc++.h>
using namespace std;
int a[104];
long long sum(long long n) {
  long long sum = 0;
  while (n != 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main() {
  long long n;
  long long s;
  long long e = 0;
  long long ans = 0;
  cin >> n;
  long long buf = n;
  while (buf != 0) {
    e++;
    buf /= 10;
  }
  e *= 9;
  cin >> s;
  if (n <= s) {
    cout << 0 << endl;
  } else {
    if (n - s < e) {
      e = n - s;
    }
    buf = s;
    for (int i = 0; i <= e; i++) {
      if (buf - sum(buf) >= s) {
        ans++;
      }
      buf++;
    }
    ans += (n - buf + 1);
    cout << ans << endl;
  }
}
