#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); A.push_back(0); for (long i = 0, sum = 0, cnt = 0; i <= N; i++) { if (A.at(i) % 2) { sum += A.at(i), cnt++; } else { if (cnt >= M) cout << sum << "\n"; sum = cnt = 0; } } }