#include #include #include #include #include using namespace std; int main() { int n, k; cin >> n >> k; vector cost( n ); int totalCost = 0; for( int i=0 ; i> cost[i]; totalCost += cost[i]; } if( k == 0 ) { cout << totalCost << endl; return 0; } if( k >= (n-1)/2 ) cout << cost[(n-1)/2] << endl; return 0; }