#C5011. Postal Box Letter Delivery
Postal Box Letter Delivery
Postal Box Letter Delivery
You are given M postal boxes and L letters that need to be delivered. Each postal box has a maximum capacity given by an array of capacities.
Your task is to determine whether it is possible to deliver all the letters without exceeding the capacity of any postal box. Formally, let \( a_1, a_2, \ldots, a_M \) be the capacities of the boxes. If the total capacity \( \sum_{i=1}^{M} a_i \) is greater than or equal to \( L \), you should output YES; otherwise, output NO.
Note: The input will be given via standard input, and the result must be printed to standard output.
inputFormat
The first line contains two integers M
and L
, representing the number of postal boxes and the number of letters respectively. The second line contains M
space-separated integers, where the i-th
integer represents the capacity of the i-th
postal box.
outputFormat
Output a single line containing YES
if it is possible to deliver all letters, otherwise print NO
.
4 10
3 4 2 3
YES