//UVA 465.cpp
#include<bits/stdc++.h>
#define readf freopen("in" , "r" , stdin);
#define writef freopen("out" , "w" , stdout);
#define gcu() getchar_unlocked()
typedef long long ll ;
typedef unsigned long long ull ;
const ll INFLL = 4e18;
const int INFINT = 2e9;
using namespace std;
int dx[]={-1, 0, 1, 0,-1, 1, 1,-1};
int dy[]={ 0, 1, 0,-1, 1, 1,-1,-1};
int SIZE = 1e5;
/*--------------------------------------------------*/
int n, k;
vector<int>a, cumSum;
/*-----------------MAIN FUNCTION--------------------*/
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
	readf
	//writef//
	#endif
	int num;
	cin >> n >> k;
	cumSum.push_back(0);
	for(int i = 0 ; i < n ; i++)
	{
		cin >> num;
		a.push_back(num);
		cumSum.push_back(cumSum[i] + a[i]);
	}
	int f = 0 , l = 0, e = 0, s = 0;
	while(e < cumSum.size())
	{
		int cmp = e - s - (cumSum[e] - cumSum[s]);
		while(cmp <= k)
		{
			if(e - s > l - f && cmp <= k)f = s, l = e;
			e++;
			cmp = e - s - (cumSum[e] - cumSum[s]);;
		}
		if(cmp < k)e++;
		else s++;
	}
	cout << l-- - f << endl;
	while(f<=l)a[f++] = 1;
	int i = 0, len = a.size();
	while(i < len)cout << a[i++] << " ";
	//------------------------------------------------------------------------
}
