#include <bits/stdc++.h>
using namespace std;
unsigned long long n, s;
bool isvalid(unsigned long long Test) {
  unsigned long long Sum = 0, Cnt = Test;
  while (Test > 0) {
    Sum += Test % 10;
    Test /= 10;
  }
  return (Cnt - Sum >= s);
}
int main() {
  cin >> n >> s;
  unsigned long long L = 0, R = n, Ans = n;
  while (L <= R) {
    unsigned long long Mid = L + (R - L) / 2;
    if (isvalid(Mid)) {
      Ans = Mid;
      R = Mid - 1;
    } else
      L = Mid + 1;
  }
  if (isvalid(Ans))
    cout << n - Ans + 1;
  else
    cout << n - Ans;
  return 0;
}
