#include #include using namespace std; // 575 const int MAX = 100000; int main() { int N, M; cin >> N >> M; static int A, odd = 0; int64_t sum = 0; for (int i = 0;i < N;++ i) { cin >> A; if (A & 1) { sum += A; ++ odd; } else { if (odd >= M) cout << sum << endl; sum = odd = 0; } } if (odd >= M) cout << sum << endl; return 0; } /* 31536000のコメント解説欄 ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー やるだけー */