#include <bits/stdc++.h>
using namespace std;
void oka() {
  long long n, i, j, k, a1 = 0, ans = 0, b = 0, cur = 0;
  cin >> n >> k;
  long long a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0, j = 0; i < n; i++) {
    if (a[i] == 1)
      a1++;
    else
      b++;
    if (b > k) {
      if (a[j] == 1)
        a1--;
      else
        b--;
      j++;
    }
    if (a1 + b > ans) ans = a1 + b, cur = j;
  }
  cout << ans << endl;
  for (i = 0; i < cur; i++) cout << a[i] << " ";
  for (i = 0; i < ans; i++) cout << 1 << " ";
  for (i = cur + ans; i < n; i++) cout << a[i] << " ";
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  t = 1;
  while (t--) oka();
}
