IntermediateRating 1300
Bus Stop
Buses with capacity c arrive every t minutes starting at time t. People arrive at the given times (sorted) and board the first bus that arrives at or after their time and has room. Print the time each person leaves.
Input
c t, then n, then n arrival times.
Output
One line.
Sample 1
Input
2 10 5 1 2 3 11 12
Output
10 10 20 20 30
Sample 2
Input
1 5 1 0
Output
5
Output appears here