#include <bits/stdc++.h>
using namespace std;
inline void fastRead_int(int &x) {
  register int c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
int main() {
  int n, k;
  fastRead_int(n);
  fastRead_int(k);
  int arr[n], totalZeros = 0, maxSum = 0, local = 0;
  bool allZero = true, allOne = true;
  vector<int> zeroPos;
  for (int i = 0; i < n; i++) {
    fastRead_int(arr[i]);
    if (arr[i]) {
      allZero = false;
      local++;
      maxSum = max(maxSum, local);
    } else {
      allOne = false;
      local = 0;
      zeroPos.push_back(i);
    }
  }
  if (0 == k) {
    cout << maxSum << endl;
    for (int i = 0; i < n; i++) {
      cout << arr[i] << " ";
    }
    cout << endl;
  } else {
    if (allOne or zeroPos.size() <= k) {
      cout << n << endl;
      for (int i = 0; i < n; i++) {
        cout << 1 << " ";
      }
      cout << endl;
    } else if (allZero) {
      cout << k << endl;
      for (int i = 0; i < n; i++) {
        if (i < k)
          cout << 1 << " ";
        else
          cout << arr[i] << " ";
      }
      cout << endl;
    } else {
      int left = 0, right = 0, ans = 0, i = 0;
      int ans_left = -1, ans_right = -1;
      while (right < n - 1) {
        if (i == 0)
          left = 0;
        else
          left = zeroPos[i - 1] + 1;
        if (i + k == zeroPos.size())
          right = n - 1;
        else
          right = zeroPos[i + k] - 1;
        if (ans < right - left + 1) {
          ans = right - left + 1;
          ans_left = left;
          ans_right = right;
        }
        i++;
      }
      cout << ans << endl;
      for (int i = 0; i < n; i++) {
        if (ans_left <= i and i <= ans_right)
          cout << 1 << " ";
        else
          cout << arr[i] << " ";
      }
      cout << endl;
    }
  }
  return 0;
}
