#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
int a[300005];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i < (n + 1); ++i) {
    cin >> a[i];
  }
  int pt = 0, cnt = 0;
  int ans = 0, idx;
  for (int i = 1; i < (n + 1); ++i) {
    cnt += (a[i] == 0);
    while (cnt > k) {
      cnt -= (a[pt + 1] == 0);
      pt++;
    }
    if (ans < (i - pt)) {
      ans = i - pt;
      idx = i;
    }
  }
  if (ans != 0) {
    for (int i = 0; i < (ans); ++i) {
      a[idx - i] = 1;
    }
  }
  cout << ans << endl;
  for (int i = 1; i < (n + 1); ++i) cout << a[i] << " ";
  cout << endl;
  return 0;
}
