# Nikhil Thakare
# Link: https://www.hackerrank.com/challenges/ctci-array-left-rotation/problem?h_l=interview&playlist_slugs%5B%5D=interview-preparation-kit&playlist_slugs%5B%5D=arrays&h_r=next-challenge&h_v=zen
# fossnitrrcp31

# Code:

#!/bin/python3

import math
import os
import random
import re
import sys

# Complete the rotLeft function below.
def rotLeft(a, d):
    first_d_element = []
    temp_d = d
    for i in range(d):
        first_d_element.append(a[i])
    
    for j in range(d,len(a)):
        a[j-temp_d] = a[j]
    print(a)
    for i in range(d):
        a[i-temp_d] = first_d_element[i]
    print(a)
    return a

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    nd = input().split()

    n = int(nd[0])

    d = int(nd[1])

    a = list(map(int, input().rstrip().split()))

    result = rotLeft(a, d)

    fptr.write(' '.join(map(str, result)))
    fptr.write('\n')

    fptr.close()
Cryptography And Network Security, 4/E