#include <bits/stdc++.h>
using namespace std;
int n, k, a[300001];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] = a[i - 1] + 1 - a[i];
  }
  int res = -1, u, v;
  for (int i = 1; i <= n; i++) {
    int d = 0, c = i;
    while (d <= c) {
      int g = (d + c) / 2;
      if (a[i] - a[g] <= k) {
        if (res < i - g) {
          res = i - g;
          u = g + 1;
          v = i;
        }
        c = g - 1;
      } else
        d = g + 1;
    }
  }
  cout << res << endl;
  for (int i = 1; i < u; i++) cout << 1 - (a[i] - a[i - 1]) << " ";
  for (int i = u; i <= v; i++) cout << "1 ";
  for (int i = v + 1; i <= n; i++) cout << 1 - (a[i] - a[i - 1]) << " ";
}
