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

    ID: 989 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 trái d bước bằng mảng phụ (Left Rotate by d Using an Auxiliary Array)

Left Rotate by d Using an Auxiliary Array (Dịch vòng trá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, normalize

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

After a left rotation by rr positions,

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

Construct bb using an auxiliary array and print it. The value dd may be much larger than nn.

Input

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

Output

Print the array after the left 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

7 9
1 2 3 4 5 6 7

Output

3 4 5 6 7 1 2

Explanation

The sample follows the mathematical definition above.