#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
bool can(long long int n, long long int m) {
  long long int n_ = n;
  long long int sum = 0;
  while (n != 0) {
    sum += n % 10;
    n /= 10;
  }
  return n_ - sum >= m;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t, n, m, a, b, c, q, k, d, p;
  cin >> n >> m;
  long long int l = 0, r = n, mid;
  p = n + 1;
  while (l <= r) {
    mid = (r + l) >> 1;
    if (can(mid, m)) {
      p = mid;
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  cout << n - p + 1 << "\n";
  return 0;
}
