#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
long long v[300500];
int main() {
  long long n, k, i, j, a, b, cnt, x;
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> v[i];
  if (n == 1 && k == 0 && v[1] == 0) {
    cout << "0\n0";
    return 0;
  }
  i = j = a = b = 1;
  x = 0;
  while (j <= n) {
    if (x < k) {
      if (!v[j]) x++;
      j++;
    } else if (v[j])
      j++;
    else {
      if (!v[i]) x--;
      i++;
    }
    if (j - i > b - a) b = j, a = i;
  }
  x = b - a;
  for (; a < b; a++) v[a] = 1;
  cout << x << endl;
  for (i = 1; i <= n; i++) cout << v[i] << " ";
}
