#include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int n, m; cin >> n >> m; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } long long sum = 0; int cnt = 0; vector ans; for (int i = 0; i < n; i++) { if (a[i] % 2 == 0) { if (cnt >= m) { ans.push_back(sum); sum = 0; cnt = 0; } } else { sum += a[i]; cnt++; } } if (cnt >= m) { ans.push_back(sum); } int sz = ans.size(); for (int i = 0; i < sz; i++) { cout << ans[i] << endl; } return 0; }