Where's the issue?
Thanks alot.
package com.codegym.task.task07.task0720;
import java.util.*;
import java.io.IOException;
import java.util.*;
/*
Checking the order
*/
public class Solution {
public static void main(String[] args) throws IOException {
Scanner s = new Scanner(System.in);
ArrayList<String> list = new ArrayList<String>();
int N = s.nextInt();
int M = s.nextInt();
for (int i = 0; i <= N; i++) {
list.add(s.nextLine());
}
int num = 0;
for (int i = 0; i < M; i++) {
list.add(list.get(num+1));
list.remove(num+1);
}
for (int i = 0; i < list.size(); i++) {
System.out.println(list.get(i));
}
}
}