#include <bits/stdc++.h>
using namespace std;
long long n, k, l = 1, r, z, al, ar, a[300005];
inline long long read() {
  long long q = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (isdigit(ch)) q = (q << 3) + (q << 1) + (ch ^ 48), ch = getchar();
  return f ? q : -q;
}
inline void print(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + 48);
}
signed main() {
  n = read(), k = read();
  for (register long long i = 1; i <= n; ++i) a[i] = read();
  while (r <= n) {
    while (z <= k && r <= n) ++r, !a[r] ? ++z : 0;
    if (r - l > ar - al) al = l, ar = r;
    if (!a[l]) --z;
    ++l;
  }
  for (register long long i = al; i < ar; ++i) a[i] = 1;
  print(ar - al), putchar('\n');
  for (register long long i = 1; i <= n; ++i) print(a[i]), putchar(' ');
  return 0;
}
