#include <bits/stdc++.h>
using namespace std;
long long LowerBownd();
long long SumOfDigits(long long x);
long long n, s;
int main() {
  cin >> n >> s;
  long long x = LowerBownd();
  if (x == -1)
    cout << "0";
  else
    cout << n - x + 1;
}
long long LowerBownd() {
  long long Answer = -1;
  long long Start = s;
  long long End = n;
  while (Start <= End) {
    long long Middle = (Start + End) / 2;
    if (Middle - SumOfDigits(Middle) >= s)
      Answer = Middle, End = Middle - 1;
    else
      Start = Middle + 1;
  }
  return Answer;
}
long long SumOfDigits(long long x) {
  long long Answer = 0;
  for (; x; x /= 10) Answer += x % 10;
  return Answer;
}
