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