#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int inf = 1e18 + 1;
bool sortbyse(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
long long sod(long long x) {
  long long sum = 0;
  while (x > 0) {
    sum += (x % 10);
    x /= 10;
  }
  return sum;
}
void solve() {
  long long n, s;
  cin >> n >> s;
  long long l = 1, r = n, mid, ans = n + 1;
  while (l <= r) {
    mid = (l + r) / 2;
    long long x = sod(mid);
    long long t = mid - x;
    if (t < s)
      l = mid + 1;
    else {
      ans = mid;
      r = mid - 1;
    }
  }
  cout << n - ans + 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q;
  q = 1;
  while (q--) {
    solve();
    cout << endl;
  }
  return 0;
}
