Company: unify
Difficulty: medium
Class Allocation Problem Description You are assigned to allocate classrooms to courses. You are given N courses numbered from 1, 2, ..., N along with the array A, where Ai is the number of students registered in the course i. You are also given M classrooms numbered from 1, 2, ..., M along with the array B, where Bi is the seating capacity of the room i. Each classroom can be assigned to at max one course. Also, classroom i can be assigned to course j only if there is enough seating capacity in classroom i for all the students taking course j, i.e. Bi >= Aj. Find the maximum number of courses that can be scheduled according to the above constraints. Input Format The first line contains two space separated integers N and M. The second line contains N space separated integers A1, A2, ..., AN. The third line contains M space separated integers B1, B2, ..., BM. Output Format Output a single integer, the maximum number of courses that can be scheduled.