#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int k;
  cin >> k;
  vector<int> growth(12, 0);
  for (int i = 0; i < 12; i++) {
    cin >> growth[i];
  }
  sort(growth.begin(), growth.end(), greater<int>());
  int sum = 0;
  int i = 0;
  while (sum < k && i < 12) {
    sum += growth[i];
    i++;
  }
  if (k == 0) {
    cout << "0";
  } else {
    if (sum < k && i == 12) {
      cout << "-1";
    } else {
      cout << i;
    }
  }
  return 0;
}
