#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int a[3 * maxn];
int n, k;
map<int, int> mp;
int main() {
  scanf("%d", &n), scanf("%d", &k);
  mp.clear();
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int maxl = 0, maxr = 0;
  int l = 1, r = 1;
  int sum = 0;
  while (r <= n) {
    while (sum <= k && r <= n) {
      if (a[r] == 0) sum++;
      if (sum == k + 1) break;
      r++;
    }
    sum--;
    if (r - l - 1 >= maxr - maxl) {
      maxl = l;
      maxr = r - 1;
    }
    if (a[l] == 0) sum--;
    l++;
  }
  if (maxr && maxl)
    printf("%d\n", (maxr - maxl + 1));
  else
    printf("%d\n", (0));
  for (int i = 1; i <= n; i++) {
    if (i >= maxl && i <= maxr) {
      printf("1 ");
    } else
      printf("%d ", a[i]);
  }
  return 0;
}
