#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> V(n);
  for (int i = 0; i != n; i++) {
    cin >> V[i];
  }
  vector<int> dp(n);
  if (V[0] == 0) {
    dp[0] = 1;
  } else {
    dp[0] = 0;
  }
  for (int i = 1; i != n; i++) {
    dp[i] = dp[i - 1];
    if (V[i] == 0) {
      dp[i]++;
    }
  }
  int max = 0;
  int p1, p2;
  for (int i = 0; i != n; i++) {
    int start = i, stop = n, mid = (start + stop) / 2;
    while (start != n - 1 && stop != i) {
      mid = (start + stop) / 2;
      int l = 0;
      if (V[i] == 0) {
        l = 1;
      }
      if (dp[mid] - dp[i] + l > k) {
        stop = mid;
      } else if (dp[mid] - dp[i] + l < k) {
        start = mid;
      } else {
        int cnt = 0;
        mid++;
        while (V[mid] == 1 && mid < n) {
          mid++;
          cnt = 1;
        }
        mid--;
        break;
      }
    }
    start = i;
    if (max < mid - start + 1) {
      max = mid - start + 1;
      p1 = start;
      p2 = mid;
      if (k == 0) {
        if (mid == start) {
          if (V[mid] == 0) {
            max = 0;
          } else {
            max = 1;
          }
          p1 = -1;
        }
      }
    }
  }
  for (int i = p1; i <= p2 && p1 != -1; i++) {
    V[i] = 1;
  }
  cout << max << endl;
  for (int i = 0; i != n; i++) {
    cout << V[i] << " ";
  }
  cout << endl;
  return 0;
}
