9562: ABC241 —— B - Pasta
[Creator : ]
Description
There is pasta consisting of $N$ noodles at Takahashi's home. The length of the $i$-th noodle is $A_i$.
Takahashi has a meal plan for the next $M$ days. On the $i$-th day, he is going to choose a pasta noodle of length exactly $B_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?
Takahashi has a meal plan for the next $M$ days. On the $i$-th day, he is going to choose a pasta noodle of length exactly $B_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?
Input
Input is given from Standard Input in the following format:
```
$N$ $M$
$A_1$ $A_2$ $\ldots$ $A_N$
$B_1$ $B_2$ $\ldots$ $B_M$
```
```
$N$ $M$
$A_1$ $A_2$ $\ldots$ $A_N$
$B_1$ $B_2$ $\ldots$ $B_M$
```
Output
If Takahashi can accomplish his meal plan, print `Yes`; otherwise, print `No`.
Constraints
- $1 \leq M \leq N \leq 1000$
- $1 \leq A_i \leq 10^9$
- $1 \leq B_i \leq 10^9$
- All values in input are integers.
- $1 \leq A_i \leq 10^9$
- $1 \leq B_i \leq 10^9$
- All values in input are integers.
Sample 1 Input
3 2
1 1 3
3 1
Sample 1 Output
Yes
He can eat the 3-rd noodle on the 1-st day and the 1-st noodle on the 2-nd day, so his meal plan is feasible.
Sample 2 Input
1 1
1000000000
1
Sample 2 Output
No
A noodle of length exactly 1 is needed.
Sample 3 Input
5 2
1 2 3 4 5
5 5
Sample 3 Output
No
Since there are only 1 noodle of length 5, he cannot have a meal on the 2-nd day.