#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const double PI = acos(-1);
const double EPS = 1e-6;
const int INF = 0x3f3f3f3f;
inline int readint() {
  int sum = 0;
  char c = getchar();
  bool f = 0;
  while (c < '0' || c > '9') {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  if (f) return -sum;
  return sum;
}
inline long long readLL() {
  long long sum = 0;
  char c = getchar();
  bool f = 0;
  while (c < '0' || c > '9') {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  if (f) return -sum;
  return sum;
}
long long n, s;
bool check(long long m) {
  long long a = m;
  while (a) {
    m -= a % 10;
    a /= 10;
  }
  return m >= s;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> s;
  long long l = 1, r = n;
  long long m;
  while (r > l) {
    m = (l + r) / 2;
    if (check(m)) {
      r = m;
    } else {
      l = m + 1;
    }
  }
  if (!check(l))
    cout << "0" << endl;
  else
    cout << n - l + 1 << endl;
  return 0;
}
