#C10953. Plant Placement Challenge

    ID: 40215 Type: Default 1000ms 256MiB

Plant Placement Challenge

Plant Placement Challenge

In this problem, you are given a set of plants and a set of environments. Each plant has a nutrient requirement, and each environment has a nutrient level. A plant can only be placed in an environment if the environment's nutrient level is greater than or equal to the plant's nutrient requirement. Formally, let the sorted nutrient requirements of the plants be (p_1, p_2, \dots, p_n) and the sorted nutrient levels of the environments be (e_1, e_2, \dots, e_m). The plants can be successfully placed if and only if for each (i) ((1 \le i \le n)), there exists an environment such that (p_i \le e_j) (with each environment used at most once).

Your task is to determine whether it is possible to place all the plants in the available environments.

inputFormat

The input is provided via standard input (stdin). The first line contains two integers (p) and (e), representing the number of plants and the number of environments respectively. The second line contains (p) integers denoting the nutrient requirements of the plants. The third line contains (e) integers denoting the nutrient levels available in each environment.

outputFormat

Output a single line to standard output (stdout) containing either "YES" if all plants can be placed in suitable environments, or "NO" otherwise.## sample

4 4
10 20 30 40
40 30 20 10
YES