#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include #include using namespace std; using namespace atcoder; using ll=long long; void IO(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); } int main(){ IO(); ll n,m; cin>>n>>m; vector h(n); for(ll i=0;i>h[i]; } vector> G(n); for(ll i=0;i>x>>y; x--; y--; G[x].push_back(y); G[y].push_back(x); } vector> dp(n,vector(2,-1e18)); dp[0][0]=0; for(ll i=0;i> dp2(n,vector(2,-1e18)); dp2[n-1][0]=0; for(ll i=n-1;i>=0;i--){ for(ll j:G[i]){ if(i>j){ if(h[i]