Please someone help......
package com.codegym.task.task07.task0720;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
/*
Shuffled just in time
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> strings = new ArrayList<>();
int N = Integer.parseInt(reader.readLine());
int M = Integer.parseInt(reader.readLine());
for (int i = 0; i < N; i++)
{
strings.add(reader.readLine());
}
int j = 1;
for (int i = 0; i < M; i++)
{
strings.add(strings.size() - j,strings
.get(i));
strings.remove(i);
j++;
}
for (String i: strings
) {
System.out.println(i);
}
}
}