#include #define rep(i, a, n) for(int i = a; i < n; i++) #define int long long using namespace std; typedef pair P; const int mod = 1000000007; const int INF = 1e18; signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n, m; cin >> n >> m; int sum = 0, cnt = 0; vector a(n); rep(i, 0, n){ cin >> a[i]; } a.push_back(INF); rep(i, 0, n + 1){ if(a[i] % 2){ sum += a[i]; cnt++; }else{ if(cnt >= m){ cout << sum << endl; sum = 0; cnt = 0; } } } }