#include <bits/stdc++.h>
using namespace std;
inline void Rd(int &res) {
  char c;
  res = 0;
  while (c = getchar(), c < '0')
    ;
  do {
    res = (res << 1) + (res << 3) + (c ^ 48);
  } while (c = getchar(), c >= '0');
}
const int S = 200;
long long n, s, ans;
int work(long long x) {
  int rs = 0;
  while (x) {
    rs += x % 10;
    x /= 10;
  }
  return rs;
}
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n && i <= S; i++) {
    int sum = work(i);
    if (abs(sum - i) >= s) ans++;
  }
  if (n > S) {
    ans += max((long long)0, n - (s + S) + 1);
    if (s < S) {
      for (long long i = S + 1; i < s + S && i <= n; i++) {
        int sum = work(i);
        if (abs(sum - i) >= s) ans++;
      }
    } else {
      for (long long i = s; i < s + S && i <= n; i++) {
        int sum = work(i);
        if (abs(sum - i) >= s) ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
