#include <bits/stdc++.h>
using namespace std;
int n, k, ans, w, s, l, r, i;
int a[400400];
int main() {
  ans = -1;
  l = 1;
  r = 0;
  scanf("%d%d", &n, &k);
  w = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i] ^= 1;
    s += a[i];
    while (s > k) {
      s -= a[w++];
    }
    if (i - w + 1 > ans) {
      ans = i - w + 1;
      l = w;
      r = i;
    }
  }
  for (int i = 1; i <= n; i++) {
    a[i] ^= 1;
  }
  for (int i = l; i <= r; i++) {
    a[i] |= 1;
  }
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++) {
    printf("%d ", a[i]);
  }
  return 0;
}
