#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T sqr(const T &a) {
  return a * a;
}
template <class T>
inline T middle(const T &a, const T &b) {
  return (a + b) / 2;
}
template <class T>
inline int len(const T &c) {
  return static_cast<int>(c.size());
}
const long double EPS = 1e-9;
const long double PI = 2 * acos(0.0);
const int N = 300100;
int a[N], pres[N];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  int j = 0;
  int ans = 0;
  pair<int, int> best{-1, -1};
  for (int i = 0; i < n; ++i) {
    pres[i] = a[i] + (i > 0 ? pres[i - 1] : 0);
    while (j <= i) {
      int diff = pres[i] - (j > 0 ? pres[j - 1] : 0);
      int span = i - j + 1;
      if (span - diff > k) {
        ++j;
      } else {
        if (ans < span) {
          ans = span;
          best = {j, i};
        }
        break;
      }
    }
  }
  printf("%d\n", ans);
  for (int i = 0; i < n; ++i) {
    int x = a[i];
    if (best.first <= i && i <= best.second) {
      x = 1;
    }
    printf("%d ", x);
  }
  puts("");
  return 0;
}
