#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  long long l = 0, r = -1, kol = 0, maxx = -1e9, ansl, ansr;
  for (l = 0; l < n; ++l) {
    if (r >= n) break;
    while (kol <= k) {
      ++r;
      if (r >= n) break;
      if (a[r] == 0) ++kol;
    }
    if (r - l > maxx) {
      maxx = r - l;
      ansl = l;
      ansr = r;
    }
    if (a[l] == 0) --kol;
  }
  for (int i = ansl; i < ansr; ++i) a[i] = 1;
  cout << ansr - ansl << endl;
  for (int i = 0; i < n; ++i) cout << a[i] << " ";
  cout << endl;
  return 0;
}
