#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b) { return a > b; }
int main() {
  int a[12], n, i, sum = 0;
  cin >> n;
  for (i = 0; i < 12; i++) cin >> a[i];
  sort(a, a + 12, cmp);
  for (i = 0; i <= 12; i++) {
    if (sum >= n) {
      cout << i << endl;
      return 0;
    }
    if (i < 12) sum += a[i];
  }
  cout << -1 << endl;
  return 0;
}
