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