#include<bits/stdc++.h> usingnamespace std; int a[300005],k,n,ans,cnt,ml,mr; intmain(){ scanf ("%d%d",&n,&k); for (int i=1;i<=n;i++)scanf ("%d",&a[i]); for (int l=1,r=1;r<=n;r++){//持续右移右端点 cnt+=!a[r]; if (cnt>k){ cnt-=!a[l]; l++; }//长了就右移左端点 if (r-l+1>ans)ans=r-l+1,ml=l,mr=r; } for (;ml<=mr;ml++)a[ml]=1; printf ("%d\n",ans); for (int i=1;i<=n;i++)printf ("%d ",a[i]); }