LUNA | 프로그래밍의 벗 PivotOJ
PivotOJ

LUNA

시간 제한: 2000ms메모리 제한: 128MB출처: CHC 2003 Regional Competition - SeniorsBOJ 1561

문제

There are M cars on a ride in an amusement park, numbered 1 to M, and N children are waiting in a queue to enter them. 

Each car has its ride duration (maximum 30 minutes) and can host only one child at a time. Once a car is empty, the next child in queue enters it. If two cars are empty at the same time, the child enters the one having a smaller number. 

Write a program that will calculate number of the car the last child in queue will enter. 

입력

The first line of the input file contains two integers N and M separated by a whitespace. N is the number of children in queue and M is number of cars on a ride, 1 ≤ N ≤ 2,000,000,000; 1 ≤ M ≤ 10000. 

The next line consists of M integers separated by whitespaces. These integers represent durations of rides for each of M cars given in minutes. Each of these numbers will be not less than 1 and not greater than 30.

출력

The first and the only line of the output file should contain the number of the car as defined above. 

예제

예제 1

입력
3 5
7 8 9 7 8
출력
3

예제 2

입력
7 2
3 2
출력
2

예제 3

입력
22 5
1 2 3 4 5
출력
4
코드를 제출하려면 로그인하세요.