#include using namespace std; typedef long long ll; #define REP(i,n) for(int i=0; i #define VLL vector #define VVI vector> #define VVLL vector> #define VC vector #define VS vector #define VVC vector> #define fore(i,a) for(auto &i:a) typedef pair P; template bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } const int INF = 1 << 30; const ll INFL = 1LL<<60; const ll mod = 1000000007; int main() { ll n, k; cin >> n >> k; VLL a(n); VVLL v(n+10, VLL(2,0)); REP(i, n) { cin >> a[i]; v[i + 1][0] = v[i][0] + a[i]; if (a[i] % 2) v[i + 1][1] = v[i][1] + 1; else v[i + 1][1] = 0; } int tmp = k; FOR(i, k, n + 1) { if (v[i][1] >= k) { if (v[i + 1][1] == 0) { cout << v[i][0] - v[i-tmp][0] << endl; tmp = k; } else tmp++; } } }