#include <bits/stdc++.h>
using namespace std;
int n, mounth[12], res = 0;
int main() {
  cin >> n;
  if (n == 0) {
    cout << 0;
    return 0;
  }
  for (int i = 0; i < 12; ++i) cin >> mounth[i];
  sort(mounth, mounth + 12);
  reverse(mounth, mounth + 12);
  for (int i = 0; i < 12; ++i) {
    res += mounth[i];
    if (res >= n) {
      cout << i + 1;
      return 0;
    }
  }
  cout << -1;
  return 0;
}
