#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, sum = 0, flag = 0;
  cin >> n;
  vector<int> v;
  for (i = 0; i < 12; i++) {
    cin >> k;
    v.push_back(k);
  }
  sort(v.begin(), v.end());
  for (i = 11; i >= 0; i--) {
    sum = sum + v[i];
    if (sum >= n) {
      flag = 1;
      break;
    }
  }
  if (flag == 0) {
    cout << -1 << endl;
    return 0;
  }
  if (n == 0)
    cout << 0 << endl;
  else
    cout << 12 - i;
}
