#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
void print(vector<long long> v) {
  long long n = v.size();
  for (long long i = 0; i < n; i++) cout << v[i] << " ";
  cout << '\n';
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b != 0) {
    if (b & 1) res *= a;
    a = a * a;
    b /= 2;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n + 1);
  vector<long long> pre(n + 1);
  for (long long i = 1; i <= n; i++) {
    cin >> v[i];
    pre[i] = pre[i - 1] + !v[i];
  }
  vector<long long> ans;
  ans = v;
  long long l = 0, r = 0;
  long long mx = 0;
  for (long long i = 1; i <= n; i++) {
    long long ini = pre[i];
    if (ini <= k) {
      long long l1 = 1;
      long long r1 = i;
      if (r1 - l1 + 1 > mx) {
        mx = r1 - l1 + 1;
        l = l1;
        r = r1;
      }
    } else {
      auto it = lower_bound(pre.begin(), pre.begin() + i + 1, ini - k);
      --it;
      long long r1 = i;
      long long l1 = it - pre.begin() + 1 + 1;
      if (r1 - l1 + 1 > mx) {
        mx = r1 - l1 + 1;
        l = l1;
        r = r1;
      }
    }
  }
  for (long long i = l; i <= r; i++) ans[i] = 1;
  cout << mx << '\n';
  for (long long i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
