#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k, i, j, max1 = 0, maxx = 0;
  scanf("%lld", &n);
  scanf("%lld", &k);
  long long int arr[n + 2], zero[n + 2];
  fill(zero, zero + n, 0);
  for (i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
    if (i != 0) {
      if (arr[i] == 0)
        zero[i] = zero[i - 1] + 1;
      else
        zero[i] = zero[i - 1];
    } else {
      if (arr[i] == 0) zero[i] = 1;
    }
  }
  long long int ctr = 0;
  i = 0;
  while (i < n) {
    while (i < n && arr[i] == 1) {
      ctr++;
      i++;
    }
    max1 = max(max1, ctr);
    i++;
    ctr = 0;
  }
  i = 0;
  j = 0;
  long long int diff = 0, l, r;
  while (i < n && j < n) {
    if (i == 0)
      diff = zero[j];
    else
      diff = zero[j] - zero[i - 1];
    if (diff <= k) {
      long long int ans1 = j - i + 1;
      if (ans1 > max1) {
        max1 = ans1;
        l = i;
        r = j;
      }
      j++;
    } else if (diff > k) {
      i++;
    }
  }
  cout << max1 << endl;
  for (i = 0; i < n; i++) {
    if (i >= l && i <= r) {
      cout << 1 << " ";
    } else
      cout << arr[i] << " ";
  }
  return 0;
}
