#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  pair<int, int> p = {-1, -1};
  int i = 0, j = 0;
  int ans = 0, f = 0;
  while (j < n) {
    f += (a[j++] == 0);
    while (f > k) {
      f -= (a[i++] == 0);
    }
    if (j - i > ans) {
      ans = j - i;
      p.first = i;
      p.second = j - 1;
    }
  }
  cout << ans << '\n';
  if (p.first != -1)
    for (int i = p.first; i <= p.second; i++) a[i] = 1;
  for (auto i : a) cout << i << " ";
  return 0;
}
