#include <bits/stdc++.h>
const int MOD = 1E9 + 7;
const long long N = 3e5 + 15;
const int maxn = 5e5 + 15;
const int letter = 130;
const int INF = 1e17;
const double pi = acos(-1.0);
const double eps = 1e-10;
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, k, a[N];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  int max1 = 0, maxid = 0;
  int l = 1, r = 0, cnt = 0;
  while (l <= n && r <= n) {
    r++;
    while (r <= n && cnt <= k) {
      if (a[r] == 0 && cnt == k) {
        break;
      }
      if (a[r] == 0) cnt++;
      r++;
    }
    r--;
    if (r - l + 1 > max1) max1 = r - l + 1, maxid = l;
    if (a[l] == 0) cnt--;
    l++;
  }
  printf("%d\n", max1);
  if (max1 == 0) {
    for (int i = 1; i <= n; i++) printf("0 ");
    printf("\n");
    return 0;
  }
  for (int i = 1; i < maxid; i++) printf("%d ", a[i]);
  for (int i = maxid; i < maxid + max1; i++) printf("1 ");
  for (int i = maxid + max1; i <= n; i++) printf("%d ", a[i]);
  printf("\n");
  return 0;
}
