#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 3E5 + 10;
int n, k, a[MAX_N], z, l = 1, r, ll, rr, ans;
void input() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
}
void binary() {
  for (int i = 1; i <= n; i++) {
    r = i;
    if (a[i] == 0) z++;
    while (z > k) {
      if (a[l] == 0) z--;
      l++;
    }
    if (r - l + 1 > ans) {
      ans = r - l + 1;
      ll = l, rr = r;
    }
  }
  for (int i = ll; i <= rr; i++) a[i] = 1;
}
void find_ans() {
  cout << ans << "\n";
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
}
int main() {
  input();
  binary();
  find_ans();
  cout << '\n';
}
