#include <bits/stdc++.h>
using namespace std;
long long n, s, l, r, mid, ans;
void cek(long long x) {
  if (x == 0) {
    return;
  } else {
    ans += x % 10;
    cek(x / 10);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  l = 1;
  r = n;
  while (l <= r) {
    ans = 0;
    mid = (l + r) / 2;
    cek(mid);
    if (mid - ans < s) {
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  cout << n - l + 1 << '\n';
  return 0;
}
