P23638 [AtCoder] Hotel
普及-
题目描述

Problem Description

Takahashi manages a hotel with $ N $ rooms. Today, there are $ M $ reservations, but he hasn't confirmed whether all reservations can be properly assigned to rooms. For each reservation, it is necessary to assign a room with a capacity greater than or equal to the number of people in the group. Each reservation must be assigned exactly one room, and it is not possible to assign multiple rooms to one reservation or assign multiple reservations to one room. If all reservations can be assigned to rooms, output YES; otherwise, output NO.

Input Format

The input is given from the 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 integers $N\ (1\ ≦\ N\ ≦\ 10^5)$, $M\ (1\ ≦\ M\ ≦\ 10^5)$ separated by spaces.
  • The second line contains $ N $ integers separated by spaces. The $i\ (1\ ≦\ i\ ≦\ N)$ -th integer represents the capacity of the $ i $ -th room, $A_i\ (1\ ≦\ A_i\ ≦\ 10^5)$.
  • The third line contains $ M $ integers separated by spaces. The $i\ (1\ ≦\ i\ ≦\ M)$ -th integer represents the number of people in the $ i $ -th reservation, $B_i\ (1\ ≦\ B_i\ ≦\ 10^5)$.

Output Format

If all reservations can be assigned to rooms, output YES; otherwise, output NO. The output should be in one line, followed by a newline.

Sample Input and Output

Sample Input #1

3 2
2 2 3
3 1

Sample Output #1

YES

Sample Input #2

3 2
2 2 3
3 3

Sample Output #2

NO

Sample Input #3

3 4
10 10 10
1 1 1 1

Sample Output #3

NO

Sample Input #4

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

Sample Output #4

YES

Notes/Hints

Partial Points

This problem has partial points.

  • If you solve the dataset where $N\ ≦\ 100$, $M\ ≦\ 100$, you will be awarded $ 60 $ points.
  • If you solve the dataset without additional constraints, you will be awarded an additional $ 40 $ points.
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 2 2 2 3 3 1
样例输出
YES