#include <bits/stdc++.h>
using namespace std;
long long a[int(5e6 + 500)];
long long s[int(5e6 + 500)];
int main() {
  long long n, K;
  cin >> n >> K;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    s[i] = s[i - 1] + (a[i] == 0);
  }
  long long li, l, r, m;
  l = 0;
  r = n;
  while (l < r) {
    m = (l + r + 1) / 2;
    bool e = 0;
    for (int i = 1; i <= n - m + 1; i++) {
      if (s[i + m - 1] - s[i - 1] <= K) li = i, e = 1;
    }
    if (e)
      l = m;
    else
      r = m - 1;
  }
  cout << l << endl;
  if (l)
    for (int i = li; i < li + l; i++) a[i] = 1;
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
