#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  vector<int> sum1(n, 0);
  vector<int> sum0(n, 0);
  sum1[0] = arr[0];
  if (!arr[0]) sum0[0] = 1;
  for (int i = 1; i < n; i++) {
    sum1[i] = sum1[i - 1] + arr[i];
    if (!arr[i])
      sum0[i] = sum0[i - 1] + 1;
    else
      sum0[i] = sum0[i - 1];
  }
  int ret = k;
  int ppret = 0;
  for (int i = 0; i < n; i++) {
    vector<int>::iterator up;
    int k1 = k;
    if (i != 0) k1 += sum0[i - 1];
    up = upper_bound(sum0.begin() + i, sum0.end(), k1);
    int p = up - sum0.begin();
    if (p >= n) p--;
    if (sum0[p] > k1) p--;
    if (p < i) continue;
    int cu;
    if (i == 0) {
      cu = sum0[p] + sum1[p];
    } else {
      cu = sum0[p] - sum0[i - 1] + sum1[p] - sum1[i - 1];
    }
    if (cu >= ret) ppret = i;
    ret = max(ret, cu);
  }
  int cnt = 1;
  for (int i = ppret; cnt <= ret; i++) {
    arr[i] = 1;
    cnt++;
  }
  cout << ret << endl;
  for (int i = 0; i < n; i++) cout << arr[i] << " ";
  cout << endl;
  return 0;
}
