#include <bits/stdc++.h>
using namespace std;
int n, a[400000], i, j = -1, k, m = 0, y = 0, l = -1, r = -1;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> a[i];
  i = 0;
  while (j != n - 1) {
    m += (1 - a[j + 1]);
    j++;
    while (m > k) {
      m -= (1 - a[i]);
      i++;
    }
    if (m <= k && y < j - i + 1) {
      l = i;
      r = j;
      y = r - l + 1;
    }
  }
  for (i = l; i <= r; i++) a[i] = 1;
  cout << y << "\n";
  for (int i = 0; i < n; i++) cout << a[i] << " ";
}
