#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, s;
  cin >> n >> s;
  long long low = 0, mid, high = n, store = n + 1;
  while (low <= high) {
    int sum = 0;
    mid = (low + high) / 2;
    long long num = mid;
    while (num > 0) {
      sum += num % 10;
      num = num / 10;
    }
    if (mid - sum >= s) {
      store = mid;
      high = mid - 1;
    } else
      low = mid + 1;
  }
  cout << n - store + 1 << "\n";
  return 0;
}
