#include <bits/stdc++.h>
using namespace std;
void func(void) {
  freopen("input.c", "r", stdin);
  freopen("output.c", "w", stdout);
}
vector<long long> v;
void divide(long long x) {
  while (x) {
    v.push_back(x % 10);
    x /= 10;
  }
  reverse(v.begin(), v.end());
}
long long getNum(string s) {
  cout << s << endl;
  long long x = 0;
  for (int i = 0; i < s.size(); i++) {
    x = (x * 10) + (s[i] - 48);
  }
  return x;
}
long long dp[200][20][2];
long long SS;
long long f(long long i, long long sum, long long tight, string s, char ch) {
  if (ch != '#') {
    s.push_back(ch);
  }
  if (i == v.size()) {
    long long zz = getNum(s);
    if (zz - sum >= SS) {
      return 1;
    }
    return 0;
  }
  if (dp[i][sum][tight] != -1) return dp[i][sum][tight];
  long long k = 9;
  long long newTight = 0;
  if (tight) {
    k = v[i];
  }
  long long x = 0;
  for (long long j = 0; j <= k; j++) {
    if (j == v[i]) {
      newTight = tight;
    }
    x += f(i + 1, sum + j, newTight, s, j + 48);
  }
  return dp[i][sum][tight] = x;
}
long long getSum(long long x) {
  long long sum = 0;
  while (x) {
    sum += x % 10;
    x /= 10;
  }
  return sum;
}
int main() {
  long long n, q, i, j = 0, temp, t, k, ans = 0, sum = 0, x, y, z, cnt = 0, m,
                     fg = 0, mx = 0, mx1 = 0, mn = 8000000000000000000,
                     mn1 = 8000000000000000000;
  cin >> n >> SS;
  long long high = n, low = 0, mid;
  while (high >= low) {
    mid = (high + low) / 2;
    if (mid - getSum(mid) >= SS) {
      high = mid - 1;
      fg = 1;
      ans = mid;
    } else {
      low = mid + 1;
    }
  }
  if (fg) {
    ans = n - ans + 1;
  }
  cout << ans << endl;
}
