#include <bits/stdc++.h>
using namespace std;
int N, K, a[300300], r, n, x, y;
int main() {
  scanf("%d %d", &N, &K);
  for (int i = 0; i < (N); i++) scanf("%d", &a[i]);
  for (int l = 0; l < (N); l++) {
    while (r < N && (a[r] || n < K)) n += !a[r++];
    if (r - l > y - x) x = l, y = r;
    if (a[l] == 0) n--;
  }
  printf("%d\n", y - x);
  for (int i = 0; i < (N); i++) {
    if (x <= i && i < y)
      printf("1 ");
    else
      printf("%d ", a[i]);
  }
  return 0;
}
