C - 旅館 解説 /

実行時間制限: 2 sec / メモリ制限: 256 MB

問題文

高橋君は部屋が N 室ある旅館を経営しています。今日は M 組の予約が入っていますが、全ての予約を適切に部屋に割り振ることができるかを確認していませんでした。各予約について、その組の人数以上の定員の部屋を割り振る必要があります。各予約について必ず 1 つの部屋が割り当てられる必要があり、1 つの予約について複数の部屋を割り当てたり、複数の予約を 1 つの部屋に割り当てたりすることはできません。全ての予約に部屋を割り振ることができるならば YES を、割り振ることができないならば NO を出力してください。


入力

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

N M
A_1 A_2 ... A_N
B_1 B_2 ... B_M
  • 1 行目には、2 つの整数 N (1 ≦ N ≦ 10^5), M (1 ≦ M ≦ 10^5) が空白区切りで与えられる。
  • 2 行目には、N 個の整数が空白区切りで与えられる。このうち i (1 ≦ i ≦ N) 番目には、i 番目の部屋の定員を表す整数 A_i (1 ≦ A_i ≦ 10^5) が与えられる。
  • 3 行目には、M 個の整数が空白区切りで与えられる。このうち i (1 ≦ i ≦ M) 番目には、i 番目の予約の人数を表す整数 B_i (1 ≦ B_i ≦ 10^5) が与えられる。

出力

全ての予約に部屋を割り振ることができるならば YES を、割り振ることができないならば NO1 行に出力せよ。出力の末尾に改行を入れること。

部分点

この問題には部分点が設定されている。

  • N ≦ 100, M ≦ 100 を満たすデータセットに正解した場合は、60 点が与えられる。
  • 追加の制約のないデータセットに正解した場合は、上記とは別に 40 点が与えられる。

入力例1

3 2
2 2 3
3 1

出力例1

YES

入力例2

3 2
2 2 3
3 3

出力例2

NO

入力例3

3 4
10 10 10
1 1 1 1

出力例3

NO

入力例4

10 10
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1

出力例4

YES

Problem Statement

Mr. Takahashi runs a N-room hotel. M parties have reservations today, but unfortunately he forgot to make sure that it is possible to assign rooms to all the reservations.

Each reservation needs to be assigned a room with the capacity of at least the size of the party. Exactly one room should be assigned to each reservation: it is not allowed to assign more than one room to one reservation, or assign one room to more than one reservation.

Determine whether it is possible to assign rooms to all reservations following the restrictions.


Input

Input is given from Standard Input in the following format:

N M
A_1 A_2 ... A_N
B_1 B_2 ... B_M
  • The first line contains two integer N (1 ≦ N ≦ 10^5) and M (1 ≦ M ≦ 10^5).
  • The second line contains N space-separated integers A_1, A_2, ..., A_N. For each i (1 ≦ i ≦ N), A_i (1 ≦ A_i ≦ 10^5) represents the capacity of the i^{th} room.
  • The third line contains M space-separated integers B_1, B_2, ..., B_M. For each i (1 ≦ i ≦ M), B_i (1 ≦ B_i ≦ 10^5) represents the size of the party making the i^{th} reservation.

Output

Print YES in a single line if it is possible to assign rooms to all reservations following the restrictions. Print NO otherwise. Be sure to print a newline at the end of output.

Partial Points

Partial points may be awarded in this problem:

  • 60 points will be awarded for passing the test set satisfying N ≦ 100, M ≦ 100.
  • Another 40 points will be awarded for passing the test set without additional constraints.

入力例1

3 2
2 2 3
3 1

出力例1

YES

入力例2

3 2
2 2 3
3 3

出力例2

NO

入力例3

3 4
10 10 10
1 1 1 1

出力例3

NO

入力例4

10 10
10 9 8 7 6 5 4 3 2 1
10 9 8 7 6 5 4 3 2 1

出力例4

YES