Every winter break, Mackenzie students go on a trip to the Lyon ski resort. Ms. William and her students are all suited up and ready to get onto the ski lift. All chairs hold two people with a certain maximum weight. Help Ms. William determine the minimum number of chairs she needs in order to send up the maximum number of students.
Input Specification
The first line will contain an integer that indicates the maximum weight capacity, , a chair can hold.
The second line will contain an integer, , that indicates how many individuals need to be brought up the chairlift.
The next lines contain integers that represent the weight, , of each individual.
Output Specification
Output the minimum number of chairs needed to send up the maximum number of
students. Then, on the next line, output YES
if there is any student(s) too heavy to
be brought up by the ski lift and NO
if all students are able to be brought up the
mountain.
Sample Input 1
18
6
1
9
18
16
12
5
Sample Output 1
4
NO
Sample Input 2
34
3
30
38
1
Sample Output 2
1
YES
Comments