#K12631. Barrel Container Challenge

    ID: 23734 Type: Default 1000ms 256MiB

Barrel Container Challenge

Barrel Container Challenge

You are given a container with a maximum height H and a number of barrels, each with a specified height. Your task is to determine whether all the barrels can be loaded into the container without exceeding its height.

The barrels are loaded one on top of the other. That is, they fit if and only if the sum of their heights is less than or equal to H. For each test case, output YES if the barrels fit, otherwise output NO.

Note: You need to process multiple test cases. Read input from standard input and write output to standard output.

inputFormat

The first line of input contains an integer T representing the number of test cases.

For each test case:

  • The first line contains two integers H and N where H is the container height and N is the number of barrels.
  • The second line contains N space-separated integers representing the heights of the barrels.

outputFormat

For each test case, output a single line containing YES if the barrels can be loaded into the container without exceeding the height H, otherwise output NO.

## sample
3
10 3
2 3 2
20 2
15 10
5 2
3 3
YES

NO NO

</p>