#include <bits/stdc++.h>
using namespace std;
const double esp = 1e-8;
int a[300008];
int main() {
  int m, k;
  while (~scanf("%d%d", &m, &k)) {
    for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
    int l = 1, als = -1, ars = -1, cnt = 0, max1 = 0;
    for (int r = 1; r <= m; r++) {
      if (a[r] == 0) cnt++;
      while (cnt > k)
        if (a[l++] == 0) cnt--;
      if (r - l + 1 > max1) {
        max1 = r - l + 1;
        als = l;
        ars = r;
      }
    }
    printf("%d\n", max1);
    for (int i = 1; i <= m; i++) {
      if (i >= als && i <= ars)
        printf("1 ");
      else
        printf("%d ", a[i]);
    }
    printf("\n");
  }
}
