atcoder#ABC241B. [ABC241B] Pasta

[ABC241B] Pasta

Score : 200200 points

Problem Statement

There is pasta consisting of NN noodles at Takahashi's home. The length of the ii-th noodle is AiA_i. Takahashi has a meal plan for the next MM days. On the ii-th day, he is going to choose a pasta noodle of length exactly BiB_i and eat it. If no such noodle is available on any day, his plan fails. Additionally, he cannot eat the same noodle on multiple days.

Can Takahashi accomplish his meal plan?

Constraints

  • 1MN10001 \leq M \leq N \leq 1000
  • 1Ai1091 \leq A_i \leq 10^9
  • 1Bi1091 \leq B_i \leq 10^9
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

A1A_1 A2A_2 \ldots ANA_N

B1B_1 B2B_2 \ldots BMB_M

Output

If Takahashi can accomplish his meal plan, print Yes; otherwise, print No.

3 2
1 1 3
3 1
Yes

He can eat the 33-rd noodle on the 11-st day and the 11-st noodle on the 22-nd day, so his meal plan is feasible.

1 1
1000000000
1
No

A noodle of length exactly 11 is needed.

5 2
1 2 3 4 5
5 5
No

Since there are only 11 noodle of length 55, he cannot have a meal on the 22-nd day.