#include <bits/stdc++.h> using namespace std; using PP = pair<long, long>; const int INF = 1e9; template <class T> T Next() { T buf; cin >> buf; return buf; } vector<int> a; int main() { int n, k; cin >> n >> k; while (n--) { a.push_back(Next<int>()); } a.push_back(0); long sum = 0; int cnt = 0; for (int v : a) { if (v % 2 == 1) { sum += v; ++cnt; } else { if (cnt >= k) { cout << sum << endl; } sum = 0; cnt = 0; } } }