#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i,n) for(int i = 0;i<((int)(n));i++) #define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++) #define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--) #define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--) typedef long long ll; typedef pair mp; ll mod = 1e9+7; ll inf = 1e18; //WA int main(void){ bool ans=false; ll n,m,a[1010],b,c; vector v[1010]; cin>>n>>m; reg(i,1,n)cin>>a[i]; rep(i,m){ cin>>b>>c; v[b].push_back(c); v[c].push_back(b); } reg(p,1,n){ rep(i,v[p].size()){ ll q = v[p][i]; rep(j,v[q].size()){ ll r = v[q][j]; if(a[p]==a[r])continue; if(a[q]>a[p] && a[q]>a[r]){ ans=true; break; }; if(a[q]