#include <bits/stdc++.h>
using namespace std;
int N[200007],K,n,br,br1,br2,br3;
int main()
{
    br=0;
    br1=br2=br3=0;
    cin>>n>>K;
    for(int i=0; i<n; i++){
        cin>>N[i];
        if(N[i]==-1) br1++;
        if(N[i]==0) br2++;
        if(N[i]==1) br3++;

        if(K<=br1) {br++; cout<<N[i]<<endl;}
        if(K<=br2) {br++; cout<<N[i]<<endl;}
        if(K<=br3) {br++; cout<<N[i]<<endl;}

    }
    cout<<br<<endl;
    return 0;
}