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