#include <bits/stdc++.h>
using namespace std;
int a[323456];
int main(void) {
  int n, k;
  cin >> n >> k;
  int res = -99999999;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int cnt_0 = 0;
  int pos1, pos2;
  int l = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) cnt_0++;
    while (cnt_0 > k) {
      if (a[l] == 0) cnt_0--;
      l++;
    }
    if (i - l > res) {
      res = i - l;
      pos1 = i;
      pos2 = l;
    }
  }
  for (int i = pos2; i <= pos1; i++) {
    a[i] = 1;
  }
  cout << pos1 - pos2 + 1 << endl;
  for (int i = 0; i < n; i++) {
    if (i != 0) cout << " ";
    cout << a[i];
  }
  return 0;
}
