#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define fep(i,n) for(i=0;i<(n);i++)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define ff first
#define ss second
#define N 1000000007
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t,r,j,i,n,k;
    cin>>n>>k;
  vi p(n);
  for(i=0;i<n;i++)
    cin>>p[i];
    
		int l=n;
        int i=0,j=l-1;
        int al=0,ee=0;
        int f=0;
        while(i<j){
            if(f==0){
                if(p[i]>=p[j])
                {al+=p[i];i++;}
                else{
                    al+=p[j];j--;
                }
            }
            else{
                if(p[i]>=p[j])
                {ee+=p[j];j--;}
                else{
                    ee+=p[i];i++;
                }
            }
        }
        if(al>ee)
            return true;
        else
            return false;
    }