#include <bits/stdc++.h>
using namespace std;
inline bool isPrime(long long int n) {
  if (n <= 1) {
    return false;
  }
  if (n <= 3) {
    return true;
  }
  if (n % 2 == 0 || n % 3 == 0) {
    return false;
  }
  for (int i = 5; i * i <= n; i = i + 6) {
    if (n % i == 0 || n % (i + 2) == 0) {
      return false;
    }
  }
  return true;
}
inline bool isEven(long long int x) {
  if (x & 1)
    return false;
  else
    return true;
}
inline int binSearch(int arr[], int val, int b) {
  int low = 0, high = b - 1, mid;
  while (low <= high) {
    mid = (low + high) / 2;
    if (arr[mid] > val) {
      high = mid - 1;
    } else if (arr[mid] < val) {
      low = mid + 1;
    } else {
      return 1;
    }
  }
  return 0;
}
int main() {
  string x, y;
  cin >> x >> y;
  long long len = y.size();
  long long s = 0;
  for (int i = 0; i < len; i++) s += y[i] - '0';
  if (s >= stoll(x)) {
    cout << 0 << endl;
    return 0;
  } else {
    long long z;
    long long t = stoll(x) - s;
    long long c[9];
    fill(c, c + 9, 0);
    for (int i = 0; i < len; i++) {
      z = y[i] - '0';
      c[z]++;
    }
    long long ans = 0;
    long long s = 0;
    for (int i = 0; i < 9; i++) {
      if (c[i] != 0) {
        c[i]--;
        s += 9 - i;
        ans++;
        if (s >= t) break;
        i--;
      }
    }
    cout << ans << endl;
  }
}
