#P2889. Unique Solution

Unique Solution

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.

5 2
3 -2 3 -2 4
5 2
3 -2 3 -12 4
0 0
No
Yes

Source

POJ Monthly--2006.07.30, Wang, Yijie