A cargo train is modeled as a singly linked list of container weights, front to back. Reverse the order of containers within every consecutive block of k containers: the 1st block is containers 1..k, the 2nd block is containers k+1..2k, and so on. If the final block has FEWER than k containers, leave that trailing block's order unchanged. Print the resulting weights.
Input format
Line 1: two space-separated integers n and k — the number of containers and the block size.
Line 2: n space-separated integers — the container weights, front to back.
Output format
n space-separated integers: the weights after reversing every full block of k.
Constraints
- 1 ≤ k ≤ n ≤ 100000
- -1000000000 ≤ weight ≤ 1000000000