#include <bits/stdc++.h>
using namespace std;
long long n, a[15], s = 0, d = 0;
int main() {
  cin >> n;
  if (n == 0)
    cout << 0 << '\n';
  else {
    for (long long i = 1; i <= 12; i++) {
      cin >> a[i];
      s += a[i];
    }
    if (s < n)
      cout << -1 << '\n';
    else {
      sort(a + 1, a + 13, greater<int>());
      long long i = 1;
      while (n > 0) {
        n -= a[i];
        d++;
        i++;
      }
      cout << d;
    }
  }
}
