#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  t = 1;
  while (t--) {
    long long int a[12], total(0);
    long long int k;
    cin >> k;
    for (long long int i = 0; i < 12; ++i) {
      cin >> a[i];
      total += a[i];
    }
    if (total < k)
      cout << "-1";
    else {
      sort(a, a + 12, greater<int>());
      long long int sum = 0;
      long long int month = 0;
      while (sum < k) {
        sum += a[month];
        month += 1;
      }
      cout << month;
    }
    cout << endl;
  }
  return 0;
}
