#K70392. Lion Feeding Times
Lion Feeding Times
Lion Feeding Times
In a busy zoo, the lion section features a unique feeding routine. There are n lions, each in its own cage arranged in a circle. The feeding order starts at lion a and then proceeds sequentially through the circle, wrapping around once the end is reached.
The lion fed at the starting position (a) receives food at minute 0, and each subsequent lion is fed 1 minute later. Specifically, the i-th lion in the order (starting from 0) is fed at minute i. However, the output must be given in the natural order of lion numbers (1-indexed). Mathematically, the feeding times satisfy
$$T_{((a-1+i) \bmod n)+1} = i, \quad \text{for } i = 0, 1, \ldots, n-1.$$
Your task is to compute and output an array of n integers, where the i-th integer represents the number of minutes until lion i is fed.
inputFormat
The input consists of a single line containing two space-separated integers:
- n (1 ≤ n ≤ 105): the number of lions.
- a (1 ≤ a ≤ n): the starting lion's position.
outputFormat
Output a single line with n space-separated integers. The i-th integer represents the number of minutes until lion i is fed.
## sample6 2
5 0 1 2 3 4