#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 l, r;
  int p = 0, j = 0, i = 0, len = 0, cnt = 0;
  while (j < n) {
    if (a[j] == 0) {
      cnt++;
    }
    while (cnt > k) {
      if (a[i] == 0) cnt--;
      i++;
    }
    if (j - i + 1 > len) {
      l = i;
      r = j;
      len = j - i + 1;
    }
    j++;
  }
  cout << len << endl;
  for (i = 0; i < n; i++) {
    if (i >= l && i <= r)
      cout << 1 << " ";
    else
      cout << a[i] << " ";
  }
}
