#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[13], k, res = 0;
  cin >> k;
  for (int i = 1; i <= 12; ++i) cin >> a[i];
  sort(a + 1, a + 13);
  for (int i = 12; i > 0; --i) {
    if (k > 0) {
      k = k - a[i];
      res++;
    }
  }
  if (k > 0)
    cout << -1;
  else
    cout << res;
  return 0;
}
