#CCBCHBAHAI0000072. Dịch vòng phải d bước bằng mảng phụ (Right Rotate by d Using an Auxiliary Array)

    ID: 990 Loại: Thông thường 2000ms 256MiB Tried: 0 Đã chấp nhận: 0 Độ khó: 1 Đăng bởi: Nhãn>Programming language basicsStatic arraysIteration techniquesImplementation techniquesInteger arithmetic

Dịch vòng phải d bước bằng mảng phụ (Right Rotate by d Using an Auxiliary Array)

Right Rotate by d Using an Auxiliary Array (Dịch vòng phải d bước bằng mảng phụ)

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem

Given a0,a1,…,an−1a_0,a_1,\ldots,a_{n-1} and a non-negative integer dd, let

r=d mod n.r=d\bmod n.

After a right rotation by rr positions,

bi=a(i−r+n) mod n(0≤i<n).b_i=a_{(i-r+n)\bmod n}\qquad(0\le i<n).

Construct bb using an auxiliary array and print it.

Input

The first line contains nn and dd. The second line contains nn integers aia_i.

Output

Print the array after the right rotation.

Subtask

Subtask 1 (20 points): 1≤n≤101\le n\le10, 0≤d≤1030\le d\le10^3, ∣ai∣≤103|a_i|\le10^3.

Subtask 2 (30 points): 1≤n≤50001\le n\le5000, 0≤d≤10120\le d\le10^{12}, ∣ai∣≤106|a_i|\le10^6.

Subtask 3 (50 points): 1≤n≤2⋅1051\le n\le2\cdot10^5, 0≤d≤10180\le d\le10^{18}, ∣ai∣≤109|a_i|\le10^9.

Example

Input

6 8
10 20 30 40 50 60

Output

50 60 10 20 30 40

Explanation

The sample follows the mathematical definition above.