#C11401. Rotation of the Conveyor Belt

    ID: 40714 Type: Default 1000ms 256MiB

Rotation of the Conveyor Belt

Rotation of the Conveyor Belt

You are given a circular conveyor belt consisting of n segments, each holding an item. The conveyor belt rotates clockwise by k positions. Your task is to determine the new order of the items after k rotations.

Because the belt is circular, rotating k times is equivalent to rotating k \mod n times. For instance, if the belt has 5 segments and is rotated 2 times, the last two items will come to the front and the remaining items will shift accordingly.

Example:

Input:
5 2
10 20 30 40 50

Output: 40 50 10 20 30

</p>

inputFormat

The input is read from stdin and has the following format:

  • The first line contains two integers n and k, where n is the number of segments and k is the number of clockwise rotations.
  • The second line contains n integers representing the items on the conveyor belt in order.

outputFormat

Output the rotated order of items as a single line on stdout where the items are separated by a space.

## sample
5 2
10 20 30 40 50
40 50 10 20 30

</p>