#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
inline T LCM(T a, T b) {
  if (a < 0) return LCM(-a, b);
  if (b < 0) return LCM(a, -b);
  return a * (b / gcd(a, b));
}
bool check(long long n, long long diff) {
  long long sum = 0, dn = n;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  if (dn - sum >= diff) return true;
  return false;
}
int main() {
  long long n, s;
  cin >> n >> s;
  long long end = n, start = 0, ans = n;
  while (start <= end) {
    long long mid = (start + end) / 2;
    if (check(mid, s)) {
      ans = mid;
      end = mid - 1;
    } else {
      start = mid + 1;
    }
  }
  int add = check(n, s);
  cout << n - ans + add * 1ll;
  return 0;
}
