#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g(200005, vector<int>());
int main() {
  ios_base::sync_with_stdio(false);
  int t = 1;
  while (t--) {
    int i, j, k, n, res = 0, cnt = 0, start = -1;
    cin >> n >> k;
    int a[n];
    for (i = 0; i < n; i++) cin >> a[i];
    map<int, int> mp;
    mp[0] = -1;
    for (i = 0; i < n; i++) {
      if (a[i] == 0) cnt++;
      if (a[i] == 0) mp[cnt] = i;
      if (cnt <= k) {
        res = max(res, i + 1);
        start = 0;
        continue;
      }
      if (res < i - mp[cnt - k]) {
        res = i - mp[cnt - k];
        start = mp[cnt - k] + 1;
      }
    }
    cout << res << "\n";
    for (i = 0; i < n; i++) {
      if (i >= start && i < start + res)
        cout << 1 << " ";
      else
        cout << a[i] << " ";
    }
  }
}
