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