#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int K, Sum = 0;
  string S;
  cin >> K >> S;
  for (int i = 0; i < S.size(); i++) {
    int a = S[i] - 48;
    Sum += a;
  }
  if (Sum >= K) {
    cout << 0 << endl;
    return 0;
  }
  long long int z = K - Sum, l = S.size();
  sort(S.begin(), S.end());
  long long int a = 0, Count = 0;
  for (int i = 0; i < l && z > 0; i++) {
    int q = S[i] - 48;
    if (z <= (9 - q)) {
      a = (a * 10) + (z);
      Count++;
      break;
    }
    a = (a * 10) + ((9 - q));
    Count++;
    z -= (9 - q);
  }
  cout << Count << endl;
  return 0;
}
