B - Takahashi's Failure Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 200

問題文

高橋君の家には N 個の食品があり、i 番目の食品のおいしさは A_i です。
また、高橋君には嫌いな食品が K 個あり、具体的には i=1,2,\ldots,K について、B_i 番目の食品が嫌いです。

高橋君は N 個の食品のうち、おいしさが最大の食品から 1 つを選んで食べようと考えています。 高橋君が嫌いな食品を食べる可能性があるならば Yes を、食べる可能性が無いならば No を出力してください。

制約

  • 1\leq K\leq N\leq 100
  • 1\leq A_i\leq 100
  • 1\leq B_i\leq N
  • B_i はすべて相異なる
  • 入力はすべて整数

入力

入力は以下の形式で標準入力から与えられる。

N K
A_1 A_2 \ldots A_N
B_1 B_2 \ldots B_K

出力

高橋君が嫌いな食品を食べる可能性があるならば Yes を、無いならば No を出力せよ。


入力例 1

5 3
6 8 10 7 10
2 3 4

出力例 1

Yes

5 個の食品の中でおいしさが最大の食品は食品 352 つであり、この 2 つのいずれかを食べます。
高橋君が嫌いな食品は 2,3,43 つであり、そのうち食品 3 を食べる可能性があります。
よって、Yes を出力します。


入力例 2

5 2
100 100 100 1 1
5 4

出力例 2

No

おいしさが最大の食品は食品 1,2,33 つであり、高橋君は嫌いな食品を食べる可能性はありません。


入力例 3

2 1
100 1
2

出力例 3

No

おいしさが最大の食品は食品 1 であり、高橋君は嫌いな食品を食べる可能性はありません。

Score : 200 points

Problem Statement

Takahashi has N foods in his house. The i-th food has the tastiness of A_i.
He dislikes K of these foods: for each i=1,2,\ldots,K, he dislikes the B_i-th food.

Out of the foods with the greatest tastiness among the N foods, Takahashi will randomly choose one and eat it.
If he has a chance to eat something he dislikes, print Yes; otherwise, print No.

Constraints

  • 1\leq K\leq N\leq 100
  • 1\leq A_i\leq 100
  • 1\leq B_i\leq N
  • All B_i are distinct.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 \ldots A_N
B_1 B_2 \ldots B_K

Output

If Takahashi has a chance to eat a food he dislikes, print Yes; otherwise, print No.


Sample Input 1

5 3
6 8 10 7 10
2 3 4

Sample Output 1

Yes

Among the five foods, the ones with the greatest tastiness are Food 3 and 5, of which he eats one.
He dislikes Food 2, 3, and 4, one of which he has a chance to eat: Food 3.
Therefore, the answer is Yes.


Sample Input 2

5 2
100 100 100 1 1
5 4

Sample Output 2

No

The foods with the greatest tastiness are Food 1, 2, and 3, none of which he has a chance to eat.


Sample Input 3

2 1
100 1
2

Sample Output 3

No

The food with the greatest tastiness is Food 1, which he has no chance to eat.