#include <bits/stdc++.h>
const bool debugging = 0;
using namespace std;
void io_on() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  io_on();
  long long n, k;
  cin >> n >> k;
  vector<long long> vect;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 0) {
      vect.push_back(i);
    }
  }
  long long beg = 0, end = k - 1;
  if (k == 0) {
    long long max = 0, cur = 0;
    for (long long i = 0; i < n; i++) {
      if (a[i] == 1) {
        cur++;
      } else {
        max = std::max(cur, max);
        cur = 0;
      }
    }
    max = std::max(cur, max);
    cout << max << "\n";
    for (long long i = 0; i < n; i++) {
      cout << a[i] << " ";
    }
  } else if (k >= vect.size()) {
    cout << n << "\n";
    for (long long i = 0; i < n; i++) {
      cout << 1 << " ";
    }
  } else {
    long long max = 0, cur, max_end = -1, max_beg = -1;
    while (end < vect.size()) {
      if (end == vect.size() - 1) {
        cur = (n - 1) - vect[beg - 1];
      } else if (beg == 0) {
        cur = vect[end + 1];
      } else {
        cur = vect[end + 1] - vect[beg - 1] - 1;
      }
      if (max < cur) {
        max = cur;
        max_beg = beg;
        max_end = end;
      }
      end++;
      beg++;
    }
    cout << max << "\n";
    for (long long i = 0; i < n; i++) {
      if (i >= vect[max_beg] && i <= vect[max_end]) {
        cout << 1 << " ";
      } else {
        cout << a[i] << " ";
      }
    }
  }
  return 0;
}
