#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
void tostring(pair<A, B> p) {
  cerr << "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <class A>
void tostring(A v) {
  int f = 1;
  string r = "{";
  for (auto& x : v) {
    if (!f) {
      r += ", ";
    }
    f = 0;
    r += to_string(x);
  }
  r += "}\n";
  cerr << r;
}
void _out() { cerr << '\n'; }
template <typename H, typename... T>
void _out(H h, T... t) {
  cerr << ' ' << h;
  _out(t...);
}
void show() { cerr << '\n'; }
template <typename H, typename... T>
void show(H h, T... t) {
  cerr << h << ' ';
  show(t...);
}
void solve() {
  long long n, s;
  cin >> n >> s;
  long long l = s, r = n, res = 0;
  auto ok = [&](long long x) {
    long long sum = 0, cx = x;
    while (x) {
      sum += x % 10;
      x /= 10;
    }
    return cx >= sum + s;
  };
  while (l <= r) {
    long long mid = l + r >> 1;
    if (ok(mid)) {
      res = n - mid + 1;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  cout << res;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
