#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long fastexp(long long x, long long n) {
  long long result = 1;
  while (n > 0) {
    if (n % 2 == 1) result *= x;
    x *= x;
    n = n / 2;
  }
  return result;
}
long long modularExp(long long x, long long n, long long mod) {
  long long result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * x) % mod;
    x = ((x % mod) * (x % mod)) % mod;
    n = n / 2;
  }
  return (result) % mod;
}
bool isPrime(long long n) {
  for (long long i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
bool mycomp(pair<long long, long long> &a, pair<long long, long long> &b) {
  if (a.first != b.first)
    return a.first < b.first;
  else
    return a.second < b.second;
}
bool check(long long x, long long k) {
  long long sum = 0;
  long long y = x;
  while (x) {
    sum += x % 10;
    x = x / 10;
  }
  if (y - sum >= k)
    return true;
  else
    return false;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  long long l = 1, r = n;
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if (check(mid, k))
      r = mid;
    else
      l = mid + 1;
  }
  if (check(l, k)) {
    if (n >= l) {
      long long ans = n - l + 1;
      cout << ans;
      return;
    }
  }
  if (check(r, k)) {
    if (n >= r) {
      long long ans = n - r + 1;
      cout << ans;
      return;
    }
  }
  cout << "0";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) solve();
}
