#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, s;
  cin >> n >> s;
  long long int temp = (s / 10) * 10;
  temp += 10;
  long long int sum = 0;
  long long int a = temp;
  while (a != 0) {
    sum += a % 10;
    a /= 10;
  }
  while (temp - sum < s) {
    temp += 10;
    sum = 0;
    a = temp;
    while (a != 0) {
      sum += a % 10;
      a /= 10;
    }
  }
  long long int zero = 0;
  cout << max(n - temp + 1, zero) << endl;
  return 0;
}
