#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, a[300001], seti = 0, l, r, z = 0, maxi = 0, fz, lt = -1,
                             rt = -1;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> a[i];
  l = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == 0) {
      z++;
      if (z == k + 1) {
        r = i - 1;
        if (r - l + 1 > maxi) {
          maxi = r - l + 1;
          lt = l;
          rt = r;
        }
        z--;
        if (a[l] == 0) {
          l++;
        } else {
          for (long long j = l + 1; j < n; j++) {
            if (a[j] == 0) {
              l = j + 1;
              break;
            }
          }
        }
      }
    }
  }
  if (n - l > maxi) {
    lt = l;
    rt = n - 1;
    maxi = n - l;
  }
  cout << maxi << endl;
  if (lt != -1)
    for (long long i = lt; i <= rt; i++) a[i] = 1;
  for (long long i = 0; i < n; i++) cout << a[i] << " ";
}
