#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(12);
  for (int i = 0; i < 12; i++) cin >> a[i];
  sort(a.rbegin(), a.rend());
  int h = 0, i = 0;
  while (h < n && i < 12) {
    h += a[i];
    i++;
  }
  if (h < n)
    cout << "-1\n";
  else
    cout << i << "\n";
  return 0;
}
