#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n);
  for (long long &x : v) cin >> x;
  long long zeros = 0, ones = 0, ans = 0, R = -1, L = -10;
  long long l = 0, r = 0;
  while (l < n) {
    while (zeros < k and r < n)
      if (v[r++])
        ones++;
      else
        zeros++;
    while (r < n and v[r] == 1) ones++, r++;
    if (r - l > ans) {
      ans = r - l;
      R = r - 1, L = l;
    }
    if (v[l])
      ones--;
    else
      zeros--;
    l++;
  }
  cout << ans << '\n';
  for (long long i = 0; i < n; i++)
    if (L <= i and i <= R)
      cout << 1 << ' ';
    else
      cout << v[i] << ' ';
}
void solve(bool testcase) {
  long long t;
  cin >> t;
  while (t--) solve();
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
