#include using namespace std; typedef long long ll; typedef pair pii; #define pb push_back #define mp make_pair #define rep(i,n) for(int i=0;i<(n);++i) const int mod=1000000007; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n,m;cin >> n >> m; ll sum=0,cnt=0; vector a(n); rep(i,n) cin >> a.at(i); vector ans; rep(i,n){ if(a.at(i)%2==0){ if(cnt>=m) ans.pb(sum); cnt=0; sum=0; } else{ cnt++; sum+=a.at(i); } } if(cnt>=m) ans.pb(sum); rep(i,ans.size()) cout << ans.at(i) << endl; }