#include <bits/stdc++.h>
using namespace std;
bool nums[3 * 100005];
int sum[3 * 100005];
int N, k;
int Find(int start) {
  int mid;
  int hi, lo;
  hi = N;
  lo = start;
  int ret = start - 1;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    int now = sum[mid] - sum[start - 1];
    if (now <= k) {
      ret = mid;
      lo = mid + 1;
    } else
      hi = mid - 1;
  }
  return ret;
}
int main() {
  int i, j;
  scanf("%d%d", &N, &k);
  for (i = 1; i <= N; i++) scanf("%d", &nums[i]);
  sum[0] = 0;
  for (i = 1; i <= N; i++) sum[i] = sum[i - 1] + (1 - nums[i]);
  int ans = 0;
  int maxst = 0, maxen = 0;
  for (i = 1; i <= N; i++) {
    int end = Find(i);
    int cur = end - i + 1;
    if (cur > ans) {
      ans = cur;
      maxst = i;
      maxen = end;
    }
  }
  printf("%d\n", ans);
  for (i = 1; i <= N; i++) {
    if (i > 1) printf(" ");
    if (i >= maxst && i <= maxen)
      printf("1");
    else
      printf("%d", nums[i]);
  }
  puts("");
  return 0;
}
