#include <bits/stdc++.h>
using namespace std;
void input(long long int n, long long int a[]) {
  for (long long int i = 0; i < n; ++i) scanf("%lld", &a[i]);
}
long long int bin_expo(long long int A, long long int B, long long int M) {
  long long int res = 1LL;
  while (B > 0) {
    if (B % 2 == 1) {
      res = (res * A) % M;
    }
    A = (A * A) % M;
    B = B / 2;
  }
  return res;
}
bool isPrime[1000000 + 1];
void sieve() {
  long long int i, j;
  memset(isPrime, true, sizeof(isPrime));
  for (i = 2; i * i <= 1000000; i++) {
    if (isPrime[i] == true) {
      for (j = i * i; j <= 1000000; j = j + i) isPrime[j] = false;
    }
  }
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
double distance(long long int x1, long long int y1, long long int x2,
                long long int y2) {
  return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2) * 1.0);
}
long long int js(long long int a) {
  long long int s = 0;
  for (; a; a /= 10) s += a % 10;
  return s;
}
int main() {
  long long int l = 0, r, n, s;
  scanf("%lld%lld", &n, &s);
  r = n + 1;
  while (l < r - 1) {
    long long int mid = (l + r) >> 1;
    if (mid - js(mid) >= s)
      r = mid;
    else
      l = mid;
  }
  printf("%lld", n - l);
  return 0;
}
