#include <bits/stdc++.h>
using namespace std;
const long long nax = 3e5 + 5;
vector<long long> adj[nax];
const long long mod = 1e9 + 7;
const long long inf = 1e18 + 7;
long long a[nax];
long long l, r;
signed main() {
  long long n, k;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ptr1 = 0;
  long long ptr2 = 0;
  long long z = 0;
  for (ptr1 = 0; ptr1 < n; ptr1++) {
    if (ptr2 < ptr1) {
      ptr2 = ptr1;
      z = 0;
    }
    while (ptr2 < n) {
      long long n_cnt = z + !a[ptr2];
      if (n_cnt > k) break;
      z += !a[ptr2];
      ptr2++;
    }
    if (ptr2 - ptr1 > r - l) {
      r = ptr2;
      l = ptr1;
    }
    if (z) z -= !a[ptr1];
  }
  cout << r - l << "\n";
  for (long long i = l; i < r; i++) a[i] = 1;
  for (long long i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
