#P6567. Exact Payment

    ID: 19779 Type: Default 1000ms 256MiB

Exact Payment

Exact Payment

Jimmy has n types of coins. The i-th coin has denomination $k_i$ and available count $a_i$. In the store, there are m watches, where the i-th watch is priced at $t_i$. Because the store cannot give change, Jimmy can only purchase a watch if he can form the exact price using his coins.

Your task is to determine, for each watch, whether Jimmy can pay the exact price using some of his coins. Each coin type can only be used up to its available count.

Note: The coin usage is considered independently for each watch.

inputFormat

The first line contains two integers $n$ and $m$, representing the number of coin types and the number of watches respectively.

The next $n$ lines each contain two integers $k_i$ and $a_i$, denoting the denomination and the available count of the i-th coin.

The last line contains $m$ integers $t_1, t_2, \ldots, t_m$, where $t_i$ is the price of the i-th watch.

outputFormat

Output exactly $m$ lines. For each watch, output Yes if Jimmy can form the exact amount to pay for the watch, otherwise output No.

sample

2 3
1 3
2 1
2 4 3
Yes

Yes Yes

</p>