#include <bits/stdc++.h>
using namespace std;
int findMinMonthToWater(int* month, short int& minLength) {
  int i;
  for (i = 0; i < 12; i++) {
    if (minLength <= 0) {
      break;
    } else {
      minLength -= month[i];
    }
  }
  return i;
}
int main() {
  short int flowerLength;
  int month[12] = {0};
  cin >> flowerLength;
  for (int i = 0; i < 12; i++) {
    cin >> month[i];
  }
  sort(month, month + 12, greater<int>());
  int ans = findMinMonthToWater(month, flowerLength);
  if (flowerLength <= 0) {
    cout << ans;
  } else {
    cout << "-1";
  }
  return 0;
}
