#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, i, x, y, c = 0;
  vector<int> v;
  cin >> n;
  for (i = 0; i < 12; i++) {
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(), v.end(), greater<int>());
  if (n == 0) {
    cout << 0 << "\n";
    return 0;
  } else {
    for (i = 0; i < 12; i++) {
      n -= v[i];
      c++;
      if (n <= 0) break;
    }
  }
  if (n > 0)
    cout << -1 << "\n";
  else
    cout << c << "\n";
  return 0;
}
