#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  int a[n];
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  int l = 0, r = 0, mxl = 0, mxr = 0, remk = k, mx = 0;
  while (l < n) {
    while (r < n) {
      if (!a[r] && !remk) break;
      remk -= !(a[r]);
      r++;
    }
    if (r - l > mx) {
      mx = r - l;
      mxr = r;
      mxl = l;
    }
    remk += !(a[l]);
    l++;
  }
  printf("%d\n", mx);
  for (int i = 0; i < n; ++i) {
    if (i >= mxl && i < mxr) a[i] = 1;
    printf("%d ", a[i]);
  }
  printf("\n");
}
