#include using namespace std; #define ll long long #define endl "\n" #define rep(i, a, n) for (int i = a; i < n; ++i) int main() { int n, m; cin >> n >> m; int cnt = 0; ll ans = 0; rep(i, 0, n) { int a; cin >> a; if (a % 2 == 1) { cnt++; ans += a; } else { if (cnt >= m) { cout << ans << endl; } cnt = 0; ans = 0; } if (i == n - 1) { if (cnt >= m) { cout << ans << endl; } } } return 0; }