#include <bits/stdc++.h>
using namespace std;
int n, k;
int ara[300005];
int main() {
  scanf("%d %d", &n, &k);
  register int i, j;
  for (i = 0; i < n; i++) scanf("%d", &ara[i]);
  i = 0, j = -1;
  int taken = 0, left, right, mx = 0;
  for (; i < n; i++) {
    while (taken <= k and j < n) {
      if (ara[j + 1] == 0) taken++;
      j++;
    }
    if (j - i > mx) mx = j - i, left = i, right = j - 1;
    if (ara[i] == 0) taken--;
  }
  cout << mx << "\n";
  for (i = 0; i < n; i++) {
    if (i >= left and i <= right)
      printf("1 ");
    else
      printf("%d ", ara[i]);
  }
}
