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;
        for (int i = 0; i < n; i++) {
            t = sc.nextInt();
            if (t == 0||kp<1)
                System.out.println(t+" ");
            else{
                kp--;
            }
        }
    } 
}