#include <bits/stdc++.h>
using namespace std;
int n;
int a[15];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < 12; i++) cin >> a[i];
  sort(a, a + 12, greater<int>());
  if (n == 0) {
    cout << "0";
    return 0;
  }
  int temp = 0;
  for (int i = 0; i < 12; i++) {
    temp += a[i];
    if (temp >= n) {
      cout << i + 1;
      return 0;
    }
  }
  cout << "-1";
  return 0;
}
