#include <bits/stdc++.h>
using namespace std;
char s[21];
long long dp[21][181][2];
long long calc(int i, int rem, bool l) {
  if (!s[i] || rem < 0) return !rem;
  long long &ret = dp[i][rem][l];
  if (ret != -1) return ret;
  ret = 0;
  for (int d = l ? 9 : s[i] - '0'; d >= 0; --d)
    ret += calc(i + 1, rem - d, l || d < s[i] - '0');
  return ret;
}
int main() {
  long long n, s;
  cin >> n >> s;
  long long res = 0;
  for (int d = 1; d <= 180; ++d) {
    if (n < d || n < s + d) continue;
    sprintf(::s, "%lld", n);
    memset(dp, -1, sizeof(dp));
    res += calc(0, d, false);
    sprintf(::s, "%lld", s + d - 1);
    memset(dp, -1, sizeof(dp));
    res -= calc(0, d, false);
  }
  printf("%lld\n", res);
  return 0;
}
