#include <bits/stdc++.h>
using namespace std;
const int MAXN = (3e5) + 2;
int a[MAXN], dp[MAXN];
int cant(int l, int r) { return (dp[r] - dp[l - 1]); }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    dp[i] = dp[i - 1];
    if (a[i] == 0) dp[i]++;
  }
  int ans = 0, p, sol_id = -1;
  for (int i = 1; i <= n; i++) {
    p = i;
    for (int jump = (1 << (int(log2(n - i + 1)))); jump; jump >>= 1) {
      while (p + jump <= n && cant(i, p + jump) <= k) p += jump;
    }
    if (!(cant(i, p) <= k)) p--;
    if (ans < p - i + 1) {
      ans = p - i + 1;
      sol_id = i;
    }
  }
  for (int i = 0; i < ans; i++) a[i + sol_id] = 1;
  cout << ans << "\n";
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  cout << "\n";
  return 0;
}
