DYY is very interested in machine learning. He has been informed that there are N courses related to machine learning, with each course taking place during a specific time interval [Li, Ri].
Due to his profound interest in machine learning, he has decided to send his top K students, including Felix Huang, Daniel Huang, Penguin07, Ding Hsuan, and others, to participate in these courses. What is the maximum number of distinct courses that DYY's K students can attend out of the total N courses?
Note: If Penguin07 attends the course during the interval [2, 5], he won't be able to attend the course in the interval [5, 10] due to the overlap at time 5.
The first line of the input contains two integers N and K.
The second line of the input contains N integers Li, representing the starting time of the courses.
The third line of the input contains N integers Ri, representing the ending time of the courses.
Print one integer, the maximum number of distinct courses DYY's students can attend in total.
Remember to print a ‘\n’ at the end of the output.
One possible answer is to attend the courses during the intervals [0, 2] and [3, 4].
Student 1 attends the courses during the intervals [1, 3] and [4, 7].
Student 2 attends the courses during the intervals [2, 4], [5, 6], and [7, 8].
As a result, two students attend a total of 5 distinct courses.
Due to overlap between the intervals, student 1 can only attend one of them.