#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A.at(i);
  }
  int begin = 0;
  int size = 0;
  int remaining = K;
  int bestBegin = 0;
  int bestSize = 0;
  while (begin + size < N) {
    if (A[begin + size] == 1) {
      size += 1;
    } else if (A[begin + size] == 0 && remaining > 0) {
      A[begin + size] = -1;
      remaining -= 1;
      size += 1;
    } else {
      if (A[begin] == -1) {
        A[begin] = 0;
        remaining += 1;
      }
      begin += 1;
      if (begin < N) {
        size = max(0, size - 1);
        if (A[begin] == 0 && size > 0) {
          remaining -= 1;
          A[begin] = -1;
        }
      }
    }
    if (bestSize < size) {
      bestSize = size;
      bestBegin = begin;
    }
  }
  cout << bestSize << "\n";
  for (int i = 0; i < N; ++i) {
    if (bestBegin <= i && i < bestBegin + bestSize) {
      cout << 1 << " ";
    } else {
      cout << max(A[i], 0) << " ";
    }
  }
  cout << "\n";
  return 0;
}
