#include using namespace std; int main() { int N, M; cin >> N >> M; vector A(N); for (int i = 0; i < N; i++) cin >> A.at(i); for (long i = 0, sum = 0, cnt = 0; i < N; i++) { if (A.at(i) % 2) { sum += A.at(i), cnt++; if (cnt == M) { cout << sum << "\n"; sum = cnt = 0; } } else { sum = cnt = 0; } } }