#include #include #include #include #include #include #include #define REP(i,a) for(int i = 0; i < (a); i++) using namespace std; int main(){ int n,m; cin >> n >> m; long long a[n]; REP(i, n) cin >> a[i]; int counter = 0; long long sum = 0; REP(i, n){ if(a[i] % 2 == 0){ if(counter >= m)cout << sum << endl; sum = 0; counter = 0; }else{ sum += a[i]; counter++; } } if(counter >= m)cout << sum << endl; }