#include <bits/stdc++.h>
using namespace std;
int a[1000006], b[1000006], len = 1;
int main() {
  int ans = 0, i, j, k, l, n, m, rem1, rem2, flog = 0;
  b[0] = -1;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (!a[i]) b[len++] = i;
  }
  for (i = 0; i < n; i++) {
    j = i;
    while (!a[i] && i < n) i++;
    if (i != j) ans = max(ans, i - j);
  }
  b[len] = n;
  ans = 0;
  if (k >= len - 1) {
    cout << n << endl;
    for (i = 0; i < n; i++) cout << 1 << " ";
    cout << endl;
  } else {
    for (i = k; i < len; i++)
      if (b[i + 1] - b[i - k] - 1 > ans) {
        rem1 = b[i - k];
        rem2 = b[i + 1];
        flog = 1;
        ans = max(ans, b[i + 1] - b[i - k] - 1);
      }
    if (flog) {
      for (i = rem1 + 1; i < rem2; i++) a[i] = 1;
      cout << ans << endl;
      for (i = 0; i < n; i++) cout << a[i] << " ";
      cout << endl;
    } else {
      cout << ans << endl;
      for (i = 0; i < n; i++) cout << a[i] << " ";
      cout << endl;
    }
  }
  return 0;
}
