#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
template <typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T, typename T1>
T amax(T& a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T& a, T1 b) {
  if (b < a) a = b;
  return a;
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
void solve() {
  long long n, k;
  cin >> n >> k;
  long long a[n], cnt = 0, l = 0, r = -1, l3, r3;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i] == 0) cnt++;
    if (cnt <= k) r++;
  }
  long long ans = r - l + 1;
  l3 = l;
  r3 = r;
  for (long long i = r + 1; i < n; ++i) {
    if (r == n - 1) break;
    if (a[i] == 0) {
      if (ans < r - l + 1) {
        ans = r - l + 1;
        l3 = l;
        r3 = r;
      }
      long long l1 = l;
      for (long long j = l1; j < n; ++j) {
        l++;
        if (a[j] == 0) break;
      }
      r++;
    } else
      r++;
  }
  if (ans < r - l + 1) {
    ans = r - l + 1;
    l3 = l;
    r3 = r;
  }
  cout << ans << "\n";
  for (long long i = 0; i < n; ++i) {
    if (i >= l3 && i <= r3)
      cout << 1 << " ";
    else
      cout << a[i] << " ";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
