#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair PII; typedef vector VI; typedef vector VVI; #define MP make_pair #define PB push_back #define inf 1000000007 #define mod 1000000007 #define rep(i,n) for(int i=0;i<(int)(n);++i) int main(){ int n,m; cin >> n >> m; vector a(n); rep(i,n)cin >> a[i]; ll sm = 0; int cnt = 0; rep(i,n){ if(a[i]%2==1){ sm += a[i]; cnt++; }else{ if(cnt>=m){ cout << sm << endl; } cnt = 0; sm = 0; } } if(cnt>=m){ cout << sm << endl; } return 0; }