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