#include <bits/stdc++.h>
using namespace std;
int beg = 0, ed = 0;
void opt() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int a[(long long)3e5 + 100];
long long b[(long long)3e5 + 100];
int main() {
  opt();
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> b[i];
    x = b[i];
    if (x == 0) a[i]++;
    if (i > 0) a[i] += a[i - 1];
  }
  int beg1 = n, ed1 = n;
  int ans = 0;
  while (ed < n) {
    while (a[ed] - a[beg] + (b[beg] == 0) <= k && ed < n) {
      ed++;
    }
    while (ed >= n) ed--;
    if (a[ed] - a[beg] + (b[beg] == 0) > k) ed--;
    if (ed - beg + 1 > ans) {
      ans = ed - beg + 1;
      ed1 = ed;
      beg1 = beg;
    }
    if (ed == n - 1) break;
    beg++;
  }
  cout << ans << endl;
  for (int i = 0; i < beg1; i++) cout << b[i] << " ";
  for (int i = beg1; i <= ed1 && i < n; i++) cout << 1 << " ";
  for (int j = ed1 + 1; j < n; j++) cout << b[j] << " ";
}
