#include <bits/stdc++.h>
using namespace std;
int main() {
  long long sum;
  cin >> sum;
  vector<long long> v(12);
  for (long long i = 0; i < 12; i++) cin >> v[i];
  sort(v.rbegin(), v.rend());
  for (long long i = 0; i < 12; i++) {
    if (sum <= 0) {
      cout << i;
      return 0;
    }
    sum -= v[i];
  }
  if (sum <= 0)
    cout << 12;
  else
    cout << -1;
  return 0;
}
