1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class tas {

	public static void main(String[] args) {
		
		try {
		InputStreamReader inp = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(inp);
            
            String input1 = null;
            String input2 = null;
            
            for (int i = 0; i < 2; i++){
            	if (i == 0) {
            		input1 = br.readLine();
            	}
            	else {
            		input2 = br.readLine();
            	}
            }
            
            String [] array1 = input1.split(" ");
            String [] array2 = input2.split(" ");
            int n = Integer.parseInt(array1[0]);
            int t = Integer.parseInt(array1[1]);

            if (t % 2 == 0) {
            	for (int i = 0; i < array2.length - 1; i++) {
            		System.out.print (array2[i] + " ");
            	}
            	System.out.print (array2[array2.length - 1]);
            } else {
            	for (int i = array2.length - 1; i > 0; i--) {
            		System.out.print (array2[i] + " ");
            	}
            	System.out.print (array2[0]);
            }
            System.exit(0);
		} catch (Exception e) {
			System.exit(1);
		}
	}
}