#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[1000], b = 0, c = 0, n, i, k, m, j;
  cin >> n;
  if (n == 0) {
    cout << 0;
    exit(0);
  }
  for (i = 1; i <= 12; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + 13);
  for (i = 12; i >= 1; i--) {
    b = b + a[i];
    c++;
    if (b >= n) {
      cout << c;
      exit(0);
    }
  }
  cout << -1;
}
