#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6;
int a[MAXN], N, K, range, maxrange, posl, posr, maxr, maxi;
vector<int> sum;
int main() {
  cin >> N >> K;
  sum.assign(N + 1, 0);
  sum[0] = 0;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    if (i == 1)
      sum[i] = 1 - a[i];
    else if (a[i])
      sum[i] = sum[i - 1];
    else
      sum[i] = sum[i - 1] + 1;
  }
  for (int i = 0; i <= N; i++) {
    int tgt = K + sum[i];
    vector<int>::iterator it = upper_bound(sum.begin(), sum.end(), tgt);
    int r = it - sum.begin();
    r--;
    range = r - i;
    if (range > maxrange) {
      maxrange = range;
      posl = i + 1;
      posr = r;
    }
  }
  cout << maxrange << endl;
  for (int i = 1; i <= N; i++) {
    if (i >= posl && i <= posr)
      cout << "1 ";
    else
      cout << a[i] << " ";
  }
  return 0;
}
