#include <bits/stdc++.h>
using namespace std;
int n, k, ans, a[310000];
int l = 1, r = 1;
int cnt, ls = 1, rs;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  while (r <= n) {
    while (r <= n && cnt <= k) {
      if (!a[r]) {
        if (cnt == k)
          break;
        else
          cnt++;
      }
      r++;
    }
    if (r - l > ans) ans = r - l, ls = l, rs = r - 1;
    while (l <= n && a[l]) l++;
    cnt--;
    l++;
  }
  printf("%d\n", ans);
  for (int i = 1; i < n; i++) {
    if (ls <= i && i <= rs)
      printf("1 ");
    else
      printf("%d ", a[i]);
  }
  if (n <= rs)
    printf("1\n");
  else
    printf("%d\n", a[n]);
  return 0;
}
