#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 5;
long long n, m;
inline long long cal(long long x) {
  long long sum = 0;
  while (x) {
    long long r = x % 10LL;
    x /= 10LL;
    sum += r;
  }
  return sum;
}
int main() {
  long long l = 1, r = 1e18;
  cin >> n >> m;
  while (r >= l) {
    long long mid = (l + r) >> 1LL;
    long long q = cal(mid);
    if (mid - q >= m) {
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  if (r >= n) {
    printf("0");
    return 0;
  }
  printf("%I64d\n", n - r);
  return 0;
}
