import java.util.Scanner;
import java.util.Vector;
public class Main{
public static int N,M;
public static Vector<Vector<Integer>> vec = new Vector<Vector<Integer>>();
public static void main(String[] args){
Scanner IN = new Scanner(System.in);
int e, f, s;
while(IN.hasNext()){
N = IN.nextInt();
M = IN.nextInt();
vec.clear();
for(e=0; e <= M; e++){
vec.add(new Vector<Integer>());
}
for(e=1; e <= N; e++){
s = IN.nextInt();
vec.elementAt(s).add(e);
}
for(e=1; e <= M; e++){
System.out.print("room " + e + ": ");
s = vec.elementAt(e).size();
if(s == 0){
System.out.println(-1);
}
else{
for(f=0; f < s; f++){
System.out.print(vec.elementAt(e).elementAt(f) + (f==s-1 ? "\n" : " "));
}
}
}
}
}
}