AdvancedRating 1900
Patch the List
The list is sorted. Add as few numbers as possible so that every value 1 … n can be written as a sum of some of the numbers (each used at most once). Print how many you add.
Input
k and n; then k sorted positive integers (or an empty line when k = 0).
Output
One integer.
Sample 1
Input
2 6 1 3
Output
1
Sample 2
Input
3 20 1 5 10
Output
2
Output appears here