#include <bits/stdc++.h>
using namespace std;
long long n, k, a[300005], dp[300005], st, ed, len, ans_st, ans_ed, temp;
vector<int> vec;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    if (a[i] == 1)
      temp++;
    else
      temp = 0;
    len = max(len, temp);
  }
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1];
    if (!a[i]) {
      ans_st = i;
      ans_ed = i;
      dp[i]++;
    }
  }
  vec.push_back(0);
  for (int i = 1; i <= n; i++) {
    vec.push_back(dp[i]);
  }
  for (int i = 0; i <= n; i++) {
    int cur = dp[i];
    st = i;
    int temp = dp[i] + k;
    ed = upper_bound(vec.begin(), vec.end(), temp) - vec.begin();
    if ((ed - st - 1) > len) {
      len = ed - st - 1;
      ans_st = st;
      ans_ed = ed;
    }
  }
  cout << len << endl;
  for (int i = 1; i <= n; i++) {
    if (i > ans_st && i < ans_ed)
      cout << "1 ";
    else
      cout << a[i] << " ";
  }
}
