#include <bits/stdc++.h>
const int mod = 1e3 + 5;
const long long inf = 0x3f3f3f3f3f3f3f;
const int maxn = 1e5 + 5;
using namespace std;
long long n, s;
int w[50];
int slo(long long x) {
  int cn = 0;
  int su = 0;
  while (x) {
    cn++;
    w[cn] = x % 10;
    x /= 10;
    su += w[cn];
  }
  int sum = 0;
  sum = w[cn] - 1 + (cn - 1) * 9;
  return max(sum, su);
}
bool judge(long long x) {
  long long tmp = x;
  int sum = 0;
  while (x) {
    sum += x % 10;
    x /= 10;
  }
  return tmp >= s + sum;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  int cn = slo(n);
  long long an = 0;
  for (long long i = s + 1; i <= n && i < s + cn + 1; i++) {
    if (judge(i)) an++;
  }
  if (n >= (s + cn)) an += n - s - cn;
  cout << an << endl;
  return 0;
}
