#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int maxn = 2000005, maxm = 29;
const double eps = 1e-9;
const double pi = acos(-1.0);
int n, m;
int a[maxn];
vector<int> b;
int main() {
  int i, j;
  scanf("%d %d", &n, &m);
  int s = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", a + i);
    s += a[i];
  }
  if (n - s <= m) {
    printf("%d\n", n);
    for (i = 0; i < n; i++) printf("1%c", i == n - 1 ? '\n' : ' ');
    return 0;
  }
  int r = 0, rt = 0, mt = 0, st, en;
  for (i = 0; i < n && mt <= m; i++) {
    if (a[i] == 0 && mt < m)
      ++mt;
    else if (a[i] == 0)
      break;
    ++rt;
  }
  r = rt;
  st = 0;
  en = i;
  for (j = 0; j < n; j++) {
    --rt;
    if (a[j] == 0) --mt;
    for (; i < n && mt <= m; i++) {
      if (a[i] == 0 && mt < m)
        ++mt;
      else if (a[i] == 0)
        break;
      ++rt;
    }
    if (rt > r) r = rt, st = j + 1, en = i;
  }
  printf("%d\n", r);
  for (i = 0; i < n; i++) {
    printf("%d%c", (i >= st && i < en) || a[i], i == n - 1 ? '\n' : ' ');
  }
  return 0;
}
