#include <bits/stdc++.h>
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, k;
  std::cin >> n >> k;
  std::vector<int> a(n), zeros, ones;
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
    if (a[i] == 0) {
      zeros.push_back(i);
    } else {
      ones.push_back(i);
    }
  }
  if (zeros.size() <= k) {
    std::cout << n << std::endl;
    for (int i = 0; i < n; ++i) {
      std::cout << "1 ";
    }
    std::cout << std::endl;
    return 0;
  }
  int left = 0, right = zeros[k] - 1;
  int max_left = left, max_right = right;
  int next_zero = k;
  int ans = right - left + 1;
  bool flag = true;
  while (flag) {
    left = zeros[next_zero - k] + 1;
    if (next_zero + 1 < zeros.size()) {
      right = zeros[next_zero + 1] - 1;
      ++next_zero;
    } else {
      right = n - 1;
      flag = false;
    }
    if (ans < right - left + 1) {
      ans = right - left + 1;
      max_left = left;
      max_right = right;
    }
  }
  for (int i = max_left; i <= max_right; ++i) {
    a[i] = 1;
  }
  std::cout << ans << std::endl;
  for (int elem : a) {
    std::cout << elem << " ";
  }
  std::cout << std::endl;
  return 0;
}
