#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int n, k, m, mx, s, e, i, j = 1, x[N], z[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int k = 1; k <= n; k++) {
    cin >> x[k];
    z[k] = z[k - 1] + !x[k];
  }
  while (j <= n) {
    while (i <= j && z[j] - z[i] > m) {
      i++;
    }
    if (mx < j - i) {
      mx = j - i;
      s = i + 1;
      e = j;
    }
    j++;
  }
  cout << mx << endl;
  for (int k = 1; k <= n; k++) {
    k >= s&& k <= e&& m ? cout << 1 : cout << x[k];
    cout << " ";
  }
  cout << endl;
  return 0;
}
