#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> a(n), sum(n + 1);
  for (int i = (0); i < int(n); ++i) {
    cin >> a[i];
    sum[i + 1] = sum[i] + 1 - a[i];
  }
  int z = 0, l, r;
  int j = 0;
  for (int i = (0); i < int(n); ++i) {
    while (j < n && sum[j + 1] - sum[i] <= k) j++;
    if (z < j - i) {
      z = j - i;
      l = i;
      r = j;
    }
  }
  cout << z << endl;
  for (int i = (l); i < int(r); ++i) a[i] = 1;
  for (int b : a) cout << b << ' ';
  cout << endl;
}
