#include <bits/stdc++.h>
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
using namespace std;
long long tests;
long long n, k, a[300256], l, r = -1, cr, ans, cnt;
void solve() {
  scanf("%I64d%I64d", &n, &k);
  for (int i = 1; i <= n; i += 1) scanf("%I64d", a + i);
  for (int cl = 1; cl <= n; cl += 1) {
    if (cr <= cl) {
      cr = cl - 1;
      cnt = 0;
    }
    while (cnt <= k && cr <= n) {
      cr++;
      if (a[cr] == 0) cnt++;
    }
    if (cnt > k) {
      if (a[cr] == 0) cnt--;
      cr--;
    }
    if (r - l + 1 < cr - cl + 1) {
      l = cl;
      r = cr;
    }
    if (a[cl] == 0) cnt--;
  }
  printf("%I64d\n", min(r - l + 1, n));
  for (int i = l; i <= r; i += 1) a[i] = 1;
  for (int i = 1; i <= n; i += 1) printf("%I64d ", a[i]);
}
int main() { solve(); }
