#include <bits/stdc++.h>
using namespace std;
bool ok(long long x, long long d) {
  long long sum = 0;
  long long n = x;
  while (x) {
    sum += (x % 10);
    x = x / 10;
  }
  if (n - sum >= d)
    return true;
  else
    return false;
}
int main() {
  long long i, j, k, l, n, m, s;
  cin >> n >> s;
  long long high = n, low = 1, mid, ans = -1;
  while (low < high) {
    mid = (low + high) / 2;
    if (ok(mid, s)) {
      ans = mid;
      high = mid - 1;
    } else {
      low = mid + 1;
    }
  }
  if (ans == -1) {
    if (ok(n, s))
      ans = 1;
    else
      ans = 0;
  } else {
    if (ok(low, s)) ans = low;
    ans = n - ans + 1;
  }
  cout << ans << endl;
}
