#include <bits/stdc++.h>
using namespace std;
int n, k, s, j, ans, st, l = 1, r = 1, e = 1;
int x[300009], y[300009];
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];
  }
  while (r <= n) {
    if (y[r] - y[l - 1] > k)
      l++;
    else
      r++;
    if (ans < r - l) {
      ans = r - l;
      st = l;
    }
  }
  cout << ans << endl;
  for (int i = st; i <= st + ans - 1; i++) x[i] = 1;
  for (int i = 1; i <= n; i++) cout << x[i] << ' ';
}
