Home Web Board ProblemSet Standing Status Statistics
long long输出请使用 %lld服务器的python版本为3.4
Problem G: Candy Box

Problem G: Candy Box

Time Limit: 1 Sec  Memory Limit: 32 MB
Submit: 105  Solved: 11
[Submit][Status][Web Board]

Description

Princess Biving has a lot of candies, and this day she wants to eat some of them.

Formally speaking, Biving has N candy boxes, and the ith box contains Ci candies. She wants to open no more than K of N boxes, and the sum candies of these K boxes is exactly M. Tell Biving whether she can accomplish this idea.

Input

The input contains multiple test cases (<= 100).

       The first line of each test case contains two integers N, Q (1<=N<=100, 1<=Q<=1000) which mean the number of candy boxes and queries. Next line contains N integer C1, C2,…,CN (1<= Ci <=100). Then comes Q lines, each line has two integers Ki and Mi (1<=Ki<=N, 1<=Mi<=10000).

Output

For each case, first output “Case #c:”, then for each query output “Yes” in a single line if Biving can accomplish her idea, otherwise output “No” .

Sample Input

4 2
1 2 2 4
1 3
2 3
4 1
1 2 4 8
3 7

Sample Output

Case #1:
No
Yes
Case #2:
Yes

HINT

[Submit][Status][Web Board]