#include <bits/stdc++.h>
const long long int mod = 1000000007;
const long long int MOD1 = (int)1e9 + 9;
const long long int MOD2 = 998244353;
const long double pi = atan2(0, -1);
const long double eps = 1e-9;
const int N = 1e6 + 7;
const int MAXR = 1000005;
long long int tests = 1;
using namespace std;
int binarySearch(int arr[], int l, int r, int x) {
  if (r >= l) {
    int mid = l + (r - l) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x);
    return binarySearch(arr, mid + 1, r, x);
  }
  return l;
}
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
void swap(long long int *p1, long long int *p2) {
  long long int temp = *p1;
  *p1 = *p2;
  *p2 = temp;
}
long long int cbratt(long long int x) {
  long long int l = 0, r = MAXR;
  while (l != r) {
    long long int m = (l + r + 1) / 2;
    if (m * m * m > x)
      r = m - 1;
    else
      l = m;
  }
  return l;
}
int findn(int num) { return (int)log10(num) + 1; }
void printLDS(vector<int> &Max) {
  reverse(Max.begin(), Max.end());
  for (auto &it : Max) {
    cout << it << ' ';
  }
}
void LongestDividingSeq(int arr[], int N, int n) {
  vector<vector<int> > LDS(N);
  LDS[0].push_back(arr[0]);
  for (int i = 1; i < N; i++) {
    for (int j = 0; j < i; j++) {
      if ((arr[i] % arr[j] == 0) && (LDS[i].size() < LDS[j].size() + 1))
        LDS[i] = LDS[j];
    }
    LDS[i].push_back(arr[i]);
  }
  int maxLength = 0;
  for (int i = 0; i < N; i++) {
    int x = LDS[i].size();
    maxLength = max(maxLength, x);
  }
  for (int i = 0; i < N; i++) {
    int size = LDS[i].size();
    if (size == maxLength && LDS[i][LDS[i].size() - 1] == n) {
      printLDS(LDS[i]);
      cout << '\t';
    }
  }
}
int sumOfDigits(long long n) {
  long long sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
long long countDigits(long long num, long long limit) {
  long long left = 1, right = num, result = 0;
  while (left <= right) {
    long long mid = (right + left) / 2;
    if ((mid - sumOfDigits(mid)) >= limit) {
      result = num - mid + 1;
      right = mid - 1;
    } else {
      left = mid + 1;
    }
  }
  return result;
}
int main() {
  vector<long long int> v;
  long long int n, l;
  cin >> n >> l;
  cout << countDigits(n, l);
}
