#abc241b. B - Pasta

B - Pasta

Score : 200200 points

问题描述

在高桥家有 NN 根意面,第 ii 根意面的长度为 AiA_i
高桥为接下来的 MM 天制定了一个用餐计划。在第 ii 天,他打算选择一根长度恰好为 BiB_i 的意面食用。如果在任何一天都没有这样的意面可供选择,则他的计划失败。另外,他不能在多天内吃同一根意面。

高桥能否完成他的用餐计划呢?

以上为通义千问 qwen-max 翻译,仅供参考。

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.

Sample Input 1

3 2
1 1 3
3 1

Sample Output 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.

Sample Input 2

1 1
1000000000
1

Sample Output 2

No

A noodle of length exactly 11 is needed.

Sample Input 3

5 2
1 2 3 4 5
5 5

Sample Output 3

No

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

update @ 2024/3/10 10:22:57