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