#C5013. Fulfill Reading Schedule

    ID: 48616 Type: Default 1000ms 256MiB

Fulfill Reading Schedule

Fulfill Reading Schedule

You are given a collection of books, each categorized by a genre, and a reading schedule that specifies the genres in the order they should be read. Your task is to determine whether the reading schedule can be fulfilled using the available books.

Formally, let \( n \) be the number of books, \( k \) the number of genres, and \( m \) the length of the reading schedule. You are provided with a list \( books\_genres \) of length \( n \) where each element is an integer between 1 and \( k \) representing the genre of a book. You are also provided with a list \( reading\_schedule \) of length \( m \) representing the required order of genres to read. For each genre \( g \) in the \( reading\_schedule \), you must have at least one corresponding book from \( books\_genres \) available (each book can only be used once). In mathematical form, if \( count(g) \) is the available number of books of genre \( g \) and \( req(g) \) is the number of times genre \( g \) appears in \( reading\_schedule \), the schedule can be fulfilled if and only if \( req(g) \le count(g) \) for every genre \( g \) that appears in the reading schedule.

inputFormat

The first line of input contains three integers \( n \), \( k \), and \( m \) separated by spaces.

The second line contains \( n \) integers representing the genres of the available books.

The third line contains \( m \) integers representing the reading schedule (genres to be read in order).

\(1 \leq n, m \leq 10^5\) and \(1 \leq k \leq 10^5\). Each genre is an integer between 1 and \( k \).

outputFormat

Output a single line containing YES if the schedule can be fulfilled with the available books, otherwise output NO.

## sample
5 3 4
1 2 3 2 1
1 2 3 2
YES

</p>