#include <bits/stdc++.h>
using namespace std;
int a[300005], n, k, l, r, ans, b, ll, rr;
int main() {
  while (~scanf("%d%d", &n, &k)) {
    for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
    l = r = 0;
    ans = 300005;
    b = k;
    if (b == 0) {
      ans = 0;
      for (int i = 0; i < n; ++i) {
        if (a[i] == 1)
          ++l;
        else {
          if (l > ans) ans = l;
          l = 0;
        }
      }
      if (l > ans) ans = l;
      printf("%d\n", ans);
      for (int i = 0; i < n; ++i) {
        printf("%d", a[i]);
        if (i == n - 1)
          printf("\n");
        else
          printf(" ");
      }
      continue;
    }
    for (int i = 0; i < n; ++i) {
      if (a[i] == 0) --b;
      if (b == 0) {
        while (i < n - 1 && a[i + 1] == 1) ++i;
        r = i;
        break;
      }
    }
    if (b > 0) r = n - 1;
    ans = r - l + 1;
    ll = l + 1;
    rr = r;
    if (b == 0 && r != n - 1) {
      for (int j = r + 1; ll < n; ++ll) {
        if (a[ll - 1] == 1) continue;
        while (j < n && a[j] == 1) ++j;
        if (j == n)
          rr = n - 1;
        else {
          while (j < n - 1 && a[j + 1] == 1) ++j;
          rr = j;
          ++j;
        }
        if (rr - ll + 1 > ans) {
          l = ll;
          r = rr;
          ans = r - l + 1;
        }
        if (j == n) break;
      }
    }
    for (int i = l; i <= r; ++i) a[i] = 1;
    printf("%d\n", ans);
    for (int i = 0; i < n; ++i) {
      printf("%d", a[i]);
      if (i == n - 1)
        printf("\n");
      else
        printf(" ");
    }
  }
  return 0;
}
