#include <bits/stdc++.h>
using namespace std;
int long long n, i, j, k, l, r;
bool check(int long long x) {
  int long long y = x, cnt = 0;
  while (y > 0) {
    cnt += y % 10;
    y /= 10;
  }
  if (x - cnt >= k) return 1;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  l = 0, r = n;
  while (l + 1 < r) {
    int long long m = (l + r) / 2;
    if (check(m))
      r = m;
    else
      l = m;
  }
  if (check(l))
    cout << n - l + 1;
  else if (check(r))
    cout << n - r + 1;
  else
    cout << 0;
}
