#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  while (b != 0) {
    long long int t = b;
    b = a % b;
    a = t;
  }
  return a;
}
long long int lcm(long long int a, long long int b) {
  return a * b / gcd(a, b);
}
bool isprime(long long int n) {
  if (n == 1) return false;
  if (n == 2) return true;
  for (long long int i = 2; i * i <= n; ++i) {
    if (n % i == 0) return false;
  }
  return true;
}
bool ispalindrome(int n) {
  long long int rev = 0, n1 = n;
  while (n1 > 0) {
    rev = rev * 10 + n1 % 10;
    n1 /= 10;
  }
  return n == rev;
}
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  vector<int> sum;
  sum.push_back(0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum.push_back(1 - a[i] + *(sum.end() - 1));
  }
  int ans = 0, pos = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i - 1] == 1) continue;
    int temp = lower_bound((sum).begin(), (sum).end(), sum[i] + k) -
               lower_bound((sum).begin(), (sum).end(), sum[i] - 1) - 1;
    if (temp > ans) {
      ans = temp;
      pos = i - 1;
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == 0 && k > 0 && i >= pos) {
      a[i] = 1;
      k--;
    }
  }
  int temp = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 1)
      temp++;
    else
      temp = 0;
    ans = max(temp, ans);
  }
  cout << ans << endl;
  for (int i = 0; i < n; i++) cout << a[i] << ' ';
}
