#include <bits/stdc++.h>
int a[300102], b[300102], n, k;
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    std::cin >> a[i];
    b[i] = b[i - 1] + !a[i];
  }
  int best = 0, pos = 0;
  for (int i = 0, j = 1; j <= n; ++j) {
    if (b[j] - b[i] <= k) {
      int d = j - i;
      if (d > best) best = d, pos = i + 1;
    } else
      ++i;
  }
  std::cout << best << std::endl;
  for (int i = 1; i <= n; ++i)
    std::cout << (i >= pos && i < pos + best ? 1 : a[i]) << ' ';
}
