Unique Solution

Time Limit
1s
Memory Limit
131072KB
Judge Program
Standard
Ratio(Solve/Submit)
0.00%(0/0)
Description:

Given N (1 N ≤ 1,000) integers a1, a2, …, aN (|ai| ≤ 100,000, 1 ≤ iN) and an integer M (1 ≤ MN), you are to determine whether there exists a unique set of 2M integers s1, e1, s2, e2, …, sM, eM (1 ≤ s1e1 < s2e2 < ... < sMeM N) such that the following sum is maximized:

Input:

The input contains multiple test cases. Each test case contains consists of two lines. The first line gives the integers N and M. The second line gives the integers a1, a2, , aN.

A pair of zeroes indicates the end of the input and should not be processed.

Output:

Output exactly one line for each test case. Output Yes if the answer is in the affirmative otherwise No.

Sample Input:
5 2
3 -2 3 -2 4
5 2
3 -2 3 -12 4
0 0
Sample Output:
No
Yes

Submit