#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll n,k; cin>>n>>k; vector A(n); rep(i,n) cin>>A[i]; priority_queue,greater> que; ll siz=0,sum=0,ans=0; for(int i=n-1;i>0;i--){ if(i%2) ans=max(ans,sum+A[i]); if(siz0){ auto t=que.top(); if(A[i]>t){ que.pop(); que.push(A[i]); sum+=A[i]-t; } } } cout<