#include <bits/stdc++.h>
using namespace std;
string itosm(long long x) {
  if (x == 0) return "0";
  string ans = "";
  while (x > 0) {
    ans += ((x % 10) + '0');
    x /= 10;
  }
  reverse(ans.begin(), ans.end());
  return ans;
}
long long stoim(string str) {
  long long ans = 0;
  long long k = 1;
  for (int i = str.length() - 1; i >= 0; i--) {
    ans += (str[i] - '0') * k;
    k *= 10;
  }
  return ans;
}
const long long infll = 1e18 + 3;
const int inf = 1009000999;
const double eps = 1e-6;
const int maxn = 1e6 + 55;
const int baseint = 1000200013;
const long long basell = 1e18 + 3;
const long double PI = acos(-1.0);
int f(long long x) {
  int ans = 0;
  while (x > 0) {
    ans += x % 10;
    x /= 10;
  }
  return ans;
}
int main() {
  srand(228228);
  ios_base::sync_with_stdio(0);
  ;
  long long n, s;
  cin >> n >> s;
  long long ans = 0;
  for (long long i = s; i < min(s + 201, n + 1); i++) {
    if (f(i) + s <= i) ans++;
    if (i == s + 200) {
      ans += (n - i);
    }
  }
  cout << ans;
  return 0;
}
