#include using namespace std; using lint = long long; template using V = vector; template using VV = V< V >; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n, m; cin >> n >> m; V<> a(n); for (auto&& e : a) cin >> e; V c(n + 1); for (int i = 0; i < n; ++i) { c[i + 1] = c[i] + a[i]; } int t = 0; for (int i = 0; i < n; ++i) { if (a[i] & 1) { ++t; if (t >= m and (i == n - 1 or ~a[i + 1] & 1)) { cout << c[i + 1] - c[i - t + 1] << '\n'; } } else { t = 0; } } }