#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10240000000,10240000000")
using namespace std;
long long cal(long long n) {
  long long temp = 0;
  long long tn = n;
  while (tn > 0) {
    temp += tn % 10;
    tn /= 10;
  }
  return n - temp;
}
int main() {
  long long n, s;
  while (cin >> n >> s) {
    long long l = s, r = n;
    while (l < r) {
      long long m = (l + r) / 2;
      if (cal(m) >= s)
        r = m;
      else
        l = m + 1;
    }
    if (l == s) {
      if (cal(l) >= s)
        cout << n - l + 1 << endl;
      else
        puts("0");
    } else if (l == n) {
      if (cal(l) >= s)
        cout << 1 << endl;
      else
        puts("0");
    } else
      cout << n - l + 1 << endl;
  }
  return 0;
}
