#GD0000006. Chuyến công tác (Business trip)
Chuyến công tác (Business trip)
Business trip
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A plant must grow by at least centimeters during the year. If it is watered in month , it grows by centimeters; otherwise it does not grow in that month. There are exactly 12 months. Find the minimum number of months needed, or print if impossible.
Input
The first line contains . The second line contains exactly 12 integers .
Output
Print the minimum number of selected months, or -1 if the target cannot be reached.
Subtasks
General constraints:
-
.
-
.
-
Subtask 1 (20 points): ,
-
Subtask 2 (30 points): ,
-
Subtask 3 (50 points): No additional constraints.
Examples
Input
5
1 1 1 1 2 2 3 2 2 1 1 1
Output
2
Explanation
Choose two months with growth values and . Their sum reaches , while no single month reaches the target.