#include <bits/stdc++.h>
using namespace std;
long long n, k;
long long nine[21], zero[21];
void Init() {
  memset(nine, 0, sizeof(nine));
  memset(zero, 0, sizeof(zero));
  for (int i = 1; i < 20; i++) nine[i] = nine[i - 1] * 10 + 9;
  zero[0] = 1;
  for (int i = 1; i < 20; i++) zero[i] = zero[i - 1] * 10;
}
int main() {
  while (scanf("%lld%lld", &n, &k) != EOF) {
    Init();
    long long a[20] = {0};
    for (int i = 18; i > 0; i--)
      if (k / nine[i]) {
        a[i] += k / nine[i];
        k = k % nine[i];
      }
    if (k) a[1]++;
    for (int i = 1; i < 18; i++)
      if (a[i] > 9) {
        a[i + 1]++;
        for (int j = 0; j <= i; j++) a[j] = 0;
      }
    long long res = 0;
    for (int i = 1; i <= 18; i++) res += a[i] * zero[i];
    long long ans = n - res + 1;
    if (ans < 0) ans = 0;
    printf("%lld\n", ans);
  }
  return 0;
}
