#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int main() {
  fast();
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> v;
    long long i, x;
    long long total = 0;
    for (i = 0; i < 12; i++) {
      cin >> x;
      total += x;
      v.push_back(x);
    }
    if (total < n) {
      cout << -1 << endl;
      continue;
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    long long sum = 0;
    for (i = 0; i < 12; i++) {
      if (sum < n) {
        sum += v[i];
      } else {
        break;
      }
    }
    cout << i << endl;
  }
  return 0;
}
