Programming Club
시간 제한1초메모리 제한1024 MB
매주 참석하는 회원 구간이 주어질 때, 각 주에 아직 풀리지 않은 가장 작은 문제 번호를 출력한다.
문제
School's programming club meets once a week and solves one problem every week. Problems are taken from a very thick and important book where they have been numbered starting from and where there's an infinite number of problems. Every week the club members attending take the book, find the problem with the smallest number that none of them has solved yet, and solve it.
The club, however, has a problem with retaining its members. Each member starts attending on some week , then attends every week until week , but never comes back after that.
Determine which problem is solved every week.
입력
On the first line of input are two space-separated integers: number of weeks () and number of club members (). Weeks are numbered . On each of the following lines are two space-separated integers: the first week and the last week when when the member attends (). You can assume that every week at least one member attends the club.
출력
Write lines into output: the number of the problem solved during week onto line .