#include <bits/stdc++.h>
using namespace std;
int n, k, a[300005], sum[300005];
int main(void) {
  while (~scanf("%d %d", &n, &k)) {
    sum[0] = 0;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      sum[i] = sum[i - 1] + a[i];
    }
    int front = -1, tail, ans = 0;
    for (int i = 1; i <= n; i++) {
      int low = i, up = n;
      while (low < up) {
        int mid = low + up + 1 >> 1;
        if (mid - (i - 1) - (sum[mid] - sum[i - 1]) <= k)
          low = mid;
        else
          up = mid - 1;
      }
      if (low == i) {
        if (k > 0) {
          if (ans < 1) {
            ans = 1;
            front = tail = i;
          }
        } else if (a[i] > ans) {
          ans = a[i];
          front = tail = i;
        }
        continue;
      }
      if (low - i + 1 > ans) {
        ans = low - i + 1;
        front = i;
        tail = low;
      }
    }
    printf("%d\n", ans);
    if (~front)
      for (int i = front; i <= tail; i++) a[i] = 1;
    for (int i = 1; i <= n; i++) printf("%d%c", a[i], " \n"[i == n]);
  }
  return 0;
}
