#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<long long> gr[1050];
long long root[1050];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ansl = 0, ansr = 0;
  long long j = 0, cnt = 0;
  for (long long i = 0; i < n; i++) {
    if (j < i) {
      j = i;
      cnt = 0;
    }
    while (j < n) {
      long long ncnt = cnt + !a[j];
      if (ncnt > k) break;
      cnt += !a[j];
      j++;
    }
    if (j - i > ansr - ansl) ansl = i, ansr = j;
    if (cnt > 0) cnt -= !a[i];
  }
  cout << ansr - ansl << endl;
  for (long long i = ansl; i < ansr; i++) a[i] = 1;
  for (long long i = 0; i < n; i++) cout << a[i] << " ";
  return 0;
}
