#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define MP make_pair
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORR(x,arr) for(auto& x:arr)
#define VI vector<int>
#define PII pair<int, int>
#define FI first 
#define SE second
#define ALL(x) (x).begin(), (x).end()
const int INF=1<<30; const ll LINF=1LL<<60 ; const ll MOD=1e9+7 ;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//-------------------
const int MX = 100000 + 7;
ll a[MX];
int n,m;
int r, l; 

// number of the set whose value is bigger than mine.

bool solve(int now){
    if(now <= 0) return false;
    ll t = a[0] + a[now];
    vector<ll> v;
    FOR(i,1,n-1) if(i != now) v.push_back(a[i]);
    l = 1; r = v.size()-1;

    int num = 0;
    while(l<r){
        while(v[l]+v[r] <= t && l<r){
            l++;
        }
        if(l<r) {num += 1; l++; r--;}
    }
    return num <= m-1;
}

int main(){
    cin >> n >> m;

    FOR(i,0,n-1){
        cin >> a[i];
    }
    sort(a+1, a+n);

    int R = n-1;
    for(int i=20;i>=0;i--){
        if(solve(R-(1<<i))){
            R -= (1<<i);
        }
    }
    
    if(R == n-1) cout << -1 << endl;
    else cout << a[R] << endl;
    return 0;
}