#include <bits/stdc++.h>
using namespace std;
int a[300010];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int j = 0;
  int cnt = 0;
  int ans = 0;
  int start = 0;
  for (int i = 0; i <= n; i++) {
    if (j < i) j = i;
    while ((cnt < k || a[j] == 1) && j <= n) {
      if (a[j] == 0) {
        cnt++;
      }
      j++;
    }
    if (i) {
      int tmp = j - i;
      if (tmp >= ans) {
        ans = tmp;
        start = i;
      }
    }
    if (a[i] == 0 && cnt > 0) {
      cnt--;
    }
  }
  cout << ans << endl;
  for (int i = 1; i <= n; i++) {
    if (i >= start && i < start + ans) {
      printf("1 ");
    } else {
      printf("%d ", a[i]);
    }
  }
  return 0;
}
