#include <bits/stdc++.h>
using namespace std;
long long n, s;
int a[1005];
bool check(long long x) {
  int pos = 0, sum = 0;
  long long tt = x;
  while (x) {
    pos++;
    a[pos] = x % 10;
    x = x / 10;
  }
  x = tt;
  for (int i = 1; i <= pos; i++) sum = sum + a[i];
  if (x - s >= sum)
    return true;
  else
    return false;
}
int main() {
  scanf("%lld%lld", &n, &s);
  long long i = 0;
  long long j = n + 1;
  long long ans = n + 1;
  while (i <= j) {
    long long mid = (i + j) / 2;
    if (check(mid))
      j = mid - 1, ans = mid;
    else
      i = mid + 1;
  }
  printf("%lld", n - ans + 1);
  return 0;
}
