#include <bits/stdc++.h>
using namespace std;
struct edge {
  long long from, to, w;
  edge(int from, int to, long long w) : from(from), to(to), w(w) {}
  bool operator<(const edge& e) const { return ((w > e.w)); }
};
void O_o() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
}
bool valid(long long i, long long j, long long n, long long m) {
  return (i >= 0 && i < n && j >= 0 && j < m);
}
long long n, k, a, b;
vector<long long> vec;
bool ok(long long x) {
  long long cnt = 999999999;
  multimap<int, pair<int, int> > mm;
  for (int i = x; i < n + 1; i++) {
    cnt = x - vec[i] + vec[i - x];
    if (cnt <= k) {
      b = i, a = i - x + 1;
      return 1;
    }
  }
  return 0;
}
int main() {
  O_o();
  cin >> n >> k;
  int arr[n + 5];
  vec.push_back(0);
  for (int i = 1; i <= int(n); i++) {
    cin >> arr[i];
    vec.push_back(arr[i] + vec.back());
  }
  long long second = 0, e = 1e9, ans = 2e9 + 7, x = 0, y = 0, i = 65;
  while (second < e) {
    long long mid = (second + e) >> 1;
    if (ok(mid)) {
      second = mid + 1;
    } else
      e = mid - 1;
  }
  second -= 3;
  while (ok(second)) ++second;
  second--;
  ok(second);
  cout << second << endl;
  for (int i = 1; i <= int(n); i++) {
    if (i >= a && i <= b)
      cout << "1 ";
    else
      cout << arr[i] << " ";
  }
  cout << endl;
  return 0;
}
