#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; ++i) cin >> a[i];
  vector<long long> dp(n + 1, 0);
  for (long long i = 0; i < n; ++i) {
    dp[i + 1] = dp[i];
    if (!a[i]) dp[i + 1]++;
  }
  long long ans = 0;
  long long mx_index = 0;
  for (long long i = 0; i < n; ++i) {
    long long cnt = k;
    if (!a[i]) cnt--;
    if (cnt < 0) continue;
    auto it = upper_bound(dp.begin(), dp.end(), dp[i + 1] + cnt) - dp.begin();
    it -= 2;
    if (it - i + 1 > ans) {
      mx_index = i;
      ans = it - i + 1;
    }
  }
  for (long long i = mx_index; i < mx_index + ans; i++) a[i] = 1;
  cout << ans << "\n";
  for (long long i = 0; i < n; ++i) cout << a[i] << " ";
  return 0;
}
