#include using namespace std; typedef long long ll; typedef pair l_l; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) //const ll mod = 1000000007; int main() { //cout.precision(10); cin.tie(0); ios::sync_with_stdio(false); ll N, M; cin >> N >> M; ll A[100050]; A[0] = 0; for(int i = 1; i <= N; i++) cin >> A[i]; A[N+1] = 0; ll index = 1; ll sum = 0; for(int i = 1; i <= N + 1; i++) { if(A[i] % 2 == 1) { sum += A[i]; continue; } if(i - index >= M) { cout << sum << endl; } sum = 0; index = i + 1; } return 0; }