#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int j = 0;
  int ansl = 0;
  int ansr = 0;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (j < i) {
      j = i;
      cnt = 0;
    }
    while (j < n) {
      int ncnt = cnt + !a[j];
      if (ncnt > k) break;
      cnt += !a[j];
      j++;
    }
    if (j - i > ansr - ansl) {
      ansl = i;
      ansr = j;
    }
    if (cnt > 0) cnt -= !a[i];
  }
  cout << ansr - ansl << endl;
  for (int i = 0; i < n; i++) {
    if (i >= ansl and i < ansr) {
      cout << 1 << " ";
    } else
      cout << a[i] << " ";
  }
  cout << endl;
}
