#include <bits/stdc++.h>
using namespace std;
int a[300000 + 10], sum[300000 + 10], n, k;
int ans1, ans2;
bool check(int x) {
  for (int i = x; i <= n; i++) {
    if (x - (sum[i] - sum[i - x]) <= k) {
      ans1 = i - x + 1;
      ans2 = i;
      return 1;
    }
  }
  return 0;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i], sum[i] = sum[i - 1] + a[i];
  int l = 0, r = n + 1;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (check(mid))
      l = mid;
    else
      r = mid;
  }
  cout << l << endl;
  for (int i = ans1; i <= ans2; i++) a[i] = 1;
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  cout << endl;
  return 0;
}
