import java.util.ArrayList;
import java.util.Scanner;

public class Nz {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        ArrayList<Integer> nz = new ArrayList<>();
        int min;
        int min_i;
        int b = -1;
        while (nz.size()<n-k) {
            min = 99;
            min_i = -1;
            for (int i = b+1; i <= k+nz.size(); i++) {
                if (a[i] < min) {
                    min = a[i];
                    min_i = i;
                }
            }
            nz.add(min);
            b = min_i;
        }
        for (int x:nz){
            System.out.print(x+" ");
        }
    }

}