#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0, num[15];
  scanf("%d", &n);
  for (int i = 0; i < 12; ++i) scanf("%d", num + i);
  sort(num, num + 12);
  for (int i = 11; i >= 0 && n > 0; n -= num[i--], ++ans)
    ;
  printf("%d\n", n > 0 ? -1 : ans);
  return 0;
}
