3.3 The Magic Library
Score: 16pts
Time Limit: 5.00 sec
In the mystical town of Codeville, there exists a magnificent library run by the wise librarian Jash and his assistant Devanshi. This library is no ordinary place – it contains enchanted books that can only be read by students who meet certain magical requirements.
One bright morning, a group of eager students arrived at the library, each hoping to borrow a book for their studies. However, due to the magical nature of the books, each student has a specific reading level – they can only understand and enjoy books that have a difficulty rating greater than or equal to their reading level. A book that is too easy will bore them, while they won't be able to comprehend anything beyond their level.

Jash has a collection of magical books, each with its own difficulty rating. The library follows strict rules:

> Each student can borrow at most one book
> Each book can be given to at most one student

> A student is considered happy only if they receive a book with difficulty ≥ their reading level
Devanshi wants to help Jash distribute the books optimally. Can you help them find the maximum number of students they can make happy?

Constraints
1 ≤ n ≤ 3×10⁴
0 ≤ m ≤ 3×10⁴
1 ≤ rᵢ ≤ 10⁹
1 ≤ dᵢ ≤ 10⁹

Input Format
The first line contains two integers n and m — the number of students and the number of books respectively.
The second line contains n integers r₁, r₂, ..., rₙ — the reading levels of the students.
The third line contains m integers d₁, d₂, ..., dₘ — the difficulty ratings of the books.

Output Format
Print a single integer — the maximum number of students that can be made happy.

Example 1
Input:
3 2
2 3 4
1 2

Output:
1

Explanation:
Students need levels [2,3,4], books have difficulties [1,2]. Only the student with level 2 can be satisfied by the book with difficulty 2.

Log In to solve the Question