#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> num(n);
  for (int &i : num) cin >> i;
  int low = 0, high = 0, zero = 0, lgl = -1, hgl = -1, ans = 0;
  while (high < n) {
    if (num[high] == 0) zero++;
    if (zero <= k) {
      if (high - low + 1 > ans) {
        lgl = low, hgl = high;
        ans = high - low + 1;
      }
    } else {
      if (num[low] == 0) zero--;
      low++;
    }
    high++;
  }
  cout << ans << endl;
  if (lgl != -1)
    for (int i = lgl; i <= hgl; i++) num[i] = 1;
  for (int i : num) cout << i << " ";
}
