#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); } int cnt = 0; long long keep_sum = 0; for (auto a: A){ if(a % 2 == 0){ if (cnt >= m){ cout << keep_sum << endl; } cnt = 0; keep_sum = 0; continue; } cnt += 1; keep_sum += a; } if (cnt >= m){ cout << keep_sum << endl; } }