#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, s, a, b, c = 0;
  cin >> n >> s;
  a = 9;
  if (s % 9) s += 9 - s % 9;
  while (a < s) {
    a = 10 * a + 9;
  }
  if (a > s) a /= 10;
  while (s > 8) {
    while (a > s) {
      a /= 10;
    }
    b = s / a;
    s -= b * a;
    c += b * (a + 1);
  }
  cout << max(0LL, n - c + 1 + s);
}
