#include #include #include #include #include #include #include #include using namespace std; #define MAXV 1000000000 #define MOD 1000000007 using ll = long long; bool operator<(const pair& a, const pair& b) { if (a.first == b.first) { return a.second < b.second; } return a.first < b.first; } ll a[100010]; int main() { ll N, M; cin >> N >> M; for (int i = 0; i < N;++i) cin >> a[i]; ll cnt = 0; ll sum = 0; for (int i = 0;i < N; ++i) { if (a[i] % 2 == 1) { cnt++; sum += a[i]; } else { if (cnt >= M) { cout << sum << endl; }cnt = 0; sum = 0; } } if (sum) cout << sum << endl; int aa; cin >> aa; }