#K69117. Check Apple Weight Exceeds Limit

    ID: 33016 Type: Default 1000ms 256MiB

Check Apple Weight Exceeds Limit

Check Apple Weight Exceeds Limit

You are given a weight limit (W) (in grams) and a list of apple weights. Your task is to determine whether the total weight of the apples exceeds the limit (W). If the total weight is strictly greater than (W), print "Yes"; otherwise, print "No".

For example, if (W = 1200) and the weights are (400), (300), and (600) grams, then the total weight is (1300) grams which is greater than (1200), so the answer is "Yes".

inputFormat

The input is read from standard input and consists of three parts separated by newlines:
1. An integer (W), representing the weight limit in grams.
2. An integer (n), representing the number of apples.
3. (n) space-separated integers, representing the weights of the apples in grams.
If (n = 0), the third line will be empty.

outputFormat

Print a single line to standard output: "Yes" if the sum of the apple weights is greater than (W); otherwise, print "No".## sample

1200
3
400 300 600
Yes