#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000010;
const int oo = 1000000000;
void input() {}
void init() {}
bool check(long long x, long long s) {
  long long i = 0, tg = x;
  while (x != 0) {
    i += x % 10;
    x = x / 10;
  }
  return (tg - i >= s);
}
void solve() {
  long long n, s;
  cin >> n >> s;
  long long ans = 0;
  long long tg = min(n, s + 18 * 9);
  for (long long i = s; i <= tg; i++)
    if (check(i, s)) ans++;
  ans += n - tg;
  cout << ans;
}
void output() {}
int main() {
  std::ios::sync_with_stdio(false);
  input();
  init();
  solve();
  output();
  return (0);
}
