#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int arr[n];
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] == 0) cnt++;
  }
  if (cnt <= k) {
    cout << n << endl;
    for (int i = 0; i < n; i++) cout << 1 << " ";
    exit(0);
  }
  int j = 0;
  cnt = 0;
  int i = 0;
  int max_length = 0, len = 0;
  int start = 0, end = 0;
  while (i < n) {
    if (arr[i] == 0) {
      cnt++;
    }
    if (cnt == k + 1) {
      len = i - j;
      if (max_length <= len) {
        max_length = len;
        start = j;
        end = i - 1;
      }
      while (j < n) {
        int flag = 0;
        if (arr[j] == 0) {
          cnt--;
          flag = 1;
        }
        j++;
        if (flag == 1) break;
      }
    }
    i++;
  }
  while (j < n) {
    if (cnt <= k) {
      len = n - j;
      if (max_length <= len) {
        max_length = len;
        start = j;
        end = n - 1;
      }
    }
    if (arr[j] == 0) cnt--;
    j++;
  }
  cout << max_length << endl;
  for (int i = 0; i < n; i++) {
    if (i >= start && i <= end)
      cout << 1 << " ";
    else
      cout << arr[i] << " ";
  }
  return 0;
}
