#include #include #include #include #include #include #include #include #include #include using namespace std; #define int long long int MOD = 1000000007; signed main() { cin.tie(0); ios::sync_with_stdio(false); int N, M; cin >> N >> M; vector A(N); int res = 0; for (int i = 0; i < N; i++) { cin >> A[i]; } A.push_back(0); int num = 0; int sum = 0; for (int i = 0; i < A.size(); i++) { if (A[i] % 2 == 0) { if (num >= M) { cout << sum << endl; } sum = 0; num = 0; } else { num++; sum += A[i]; } } }