#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 i = 0, j = 0, mx = 0, s, cnt0 = 0;
  while (j < n) {
    if (a[j] == 1) {
      j++;
    } else {
      if (cnt0 < k) {
        j++;
        cnt0++;
      } else {
        if (a[i] == 0) {
          cnt0--;
        }
        i++;
      }
    }
    if (j - i > mx) {
      mx = j - i;
      s = i;
    }
  }
  cout << mx << endl;
  for (int i = s; i < s + mx; i++) {
    a[i] = 1;
  }
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
