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