import java.util.*;

public class railway{
 public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
 
  while (sc.hasNextInt()){
   int count = sc.nextInt();
   int array = sc.nextInt();  
   String kam = "";

   if (count != 0 || array != 0){
    int pole[][] = new int[array][count + 2];   

    for (int i = 0; i < count; i++){
     int car = sc.nextInt();
     
     for (int x = 0; x < array; x++) {
       int cisel = pole[x][1];

       if (car >= pole[x][0]){
        pole[x][cisel + 2] = car;
        pole[x][0] = car;
        pole[x][1] = cisel + 1;

        if (!kam.equals("")){
         kam = kam.concat(" ");
        }

        kam = kam.concat(Integer.toString(x + 1));
       
        break;
       }
       else if (x == array - 1){
        kam = "Transportation failed"; 
      }
     }
    }
    
    System.out.println(kam);

    if (!kam.equals("Transportation failed")) {
     String out = "";
     
     for (int z = array - 1; z >= 0; z--){
      for (int a = 0; a < pole[z][1]; a++) {
       if (!out.equals("")){
        out = out.concat(" ");
       }

       out = out.concat(Integer.toString(z + 1)); 
      }
     }

     System.out.println(out);
    }

    continue;
   }
  }
 }
}