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 t;
        ArrayList<Integer> nz = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            t = sc.nextInt();
            if (t == 0||kp<1)
                nz.add(t);
            else{
                kp--;
            }
            if (nz.size()==n-k){
                break;
            }
        }
        for (int i = 0; i<n-k; i++) {
            System.out.print(nz.get(i)+" ");
        }
    } 
}