#include <bits/stdc++.h>
using namespace std;
int a[50];
int main() {
  int n, i, ans = 0, sum = 1;
  cin >> n;
  for (i = 1; i <= 12; i++) cin >> a[i];
  sort(a + 1, a + 13, greater<int>());
  while (sum <= 12 && n > 0) {
    ans++;
    n = n - a[sum];
    sum++;
  }
  if (n > 0)
    cout << "-1" << endl;
  else
    cout << ans << endl;
  return 0;
}
