Breaking Chocolates

0

0 votes
Easy
Problem

Sonam Gupta is an intelligent girl. One day her father brought a long chocolate, which consists of small pieces of chocolate glued one after another, which are numbered 1 through N. The length of each piece is A[i].
Initially, for each i (1iN1), piece i and i+1 are glued at the ends, forming one long chocolate with N1 joints. Sonam will try to break all the joints by performing the following operation:
Choose a (connected) chocolate piece with a total length of at least L, then break one of its joints.

Is it possible to break all the N1 joints and get N pieces by applying this operation?
Print YES if possible, else print NO.

INPUT:
First line of input contains an integer t, the number of test cases. 1t100.
Then t testcases follow.
First line of each testcase contains two integers N and L.
Then in second line, N integers are given each is A[i], (1iN)

CONSTRAINTS:
1t100
2N100000
1L1000000000
1A[i]1000000000

OUTPUT:
Print YES or NO for each testcase in new line if it's possible to break all N1 joints.

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?