Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Unique Solution
Time Limit: 1000MSMemory Limit: 131072K
Total Submissions: 1136Accepted: 257

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

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator