import static java.lang.Integer.max;
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 kp = k;
        int[] a = new int[n];
        ArrayList<Integer> nz = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();           
        }
        for (int i = 0; i < n; i++) {
            if (a[i] == 0||kp<1){
                nz.add(a[i]);
                kp--;
            }
        }
        for (int i = 0; i<n-k; i++) {
            System.out.print(nz.get(i)+" ");
        }
    } 
}