#include <bits/stdc++.h>
using namespace std;
int n, k, s, j, ans, st;
int x[300009], y[300009];
bool ok(int m) {
  for (int i = 1; i + m - 1 <= n; i++) {
    if (y[i + m - 1] - y[i - 1] <= k) {
      s = i + m - 1;
      return 1;
    }
  }
  return 0;
}
int bs() {
  int l = 0, h = 4e5, m;
  while (h > l) {
    m = (l + h + 1) / 2;
    if (ok(m))
      l = m;
    else
      h = m - 1;
  }
  return l;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int a = 1; a <= n; a++) {
    scanf("%d", &x[a]);
    y[a] = x[a];
  }
  for (int i = 1; i <= n; i++) {
    if (!y[i])
      y[i] = y[i - 1] + 1;
    else
      y[i] = y[i - 1];
  }
  int t = bs();
  cout << t << endl;
  for (int i = s; i >= s - t + 1; i--) x[i] = 1;
  for (int i = 1; i <= n; i++) cout << x[i] << ' ';
}
