You've got an undirected graph, consisting of *n* vertices and *m* edges. We will consider the graph's vertices numbered with integers from 1 to *n*. Each vertex of the graph has a color. The color of the *i*-th vertex is an integer *c*<sub class="lower-index">*i*</sub>.

Let's consider all vertices of the graph, that are painted some color *k*. Let's denote a set of such as *V*(*k*). Let's denote the value of the neighbouring color diversity for color *k* as the cardinality of the set *Q*(*k*) = {*c*<sub class="lower-index">*u*</sub> :  *c*<sub class="lower-index">*u*</sub> ≠ *k* and there is vertex *v* belonging to set *V*(*k*) such that nodes *v* and *u* are connected by an edge of the graph}.

Your task is to find such color *k*, which makes the cardinality of set *Q*(*k*) maximum. In other words, you want to find the color that has the most diverse neighbours. Please note, that you want to find such color *k*, that the graph has at least one vertex with such color.
The first line contains two space-separated integers *n*, *m* (1 ≤ *n*, *m* ≤ 10<sup class="upper-index">5</sup>) — the number of vertices end edges of the graph, correspondingly. The second line contains a sequence of integers *c*<sub class="lower-index">1</sub>, *c*<sub class="lower-index">2</sub>, ..., *c*<sub class="lower-index">*n*</sub> (1 ≤ *c*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">5</sup>) — the colors of the graph vertices. The numbers on the line are separated by spaces.

Next *m* lines contain the description of the edges: the *i*-th line contains two space-separated integers *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub> ≤ *n*; *a*<sub class="lower-index">*i*</sub> ≠ *b*<sub class="lower-index">*i*</sub>) — the numbers of the vertices, connected by the *i*-th edge. 

It is guaranteed that the given graph has no self-loops or multiple edges.
#include "bits/stdc++.h"
using namespace std;

typedef long long           ll;
typedef pair<int,int>       pii;
typedef pair<ll,ll>         pll;
typedef vector<int>         vi;
typedef vector<ll>          vll;
typedef vector<pii>         vpii;
typedef vector<vi>          vvi;
#define take(n)             int n;cin>>n
#define takl(n)             ll n; cin>>n
#define pb                  push_back
#define br                  upper_bound
#define bl                  lower_bound
#define folr(i,l,r,d)       for(ll i=l; d<0?i>r:(d>0?i<r:0); i+=d)
#define fo(i,n)             folr(i,0,n,1)
#define takevect(a,n)       vector<int> a(n); cin>>a;
#define all(x)              x.begin(), x.end()
#define ff                  first
#define ss                  second
#define elif                else if
#define el                  "\n"
#define print(x)            cout<<x<<"\n"



template <typename A, typename B> ostream& operator<< (ostream &cout, pair<A, B> const &p) { return cout << "(" << p.first << ", " << p.second << ")\n"; }
template <typename A, typename B> istream& operator>> (istream& cin, pair<A, B> &p) {cin >> p.first; return cin >> p.second;}
template <typename A> ostream& operator<< (ostream &cout, vector<A> const &v) {cout << "["; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]\n";}
template <typename A> istream& operator>> (istream& cin, vector<A> &x){for(int i = 0; i < x.size()-1; i++) cin >> x[i]; return cin >> x[x.size()-1];}
template <typename A, typename B> A amax (A &a, B b){ if (b > a) a = b ; return a; }
template <typename A, typename B> A amin (A &a, B b){ if (b < a) a = b ; return a; }

int mod=1e9+7;
int pmod=998244353;

void solve() {
    int n,m;
    cin>>n>>m;
    takevect(c,n);
    map<int,set<int>> d;
    set<int> clr;
    for(auto x: c){
        clr.insert(x);
    }
    fo(i,m){
        int a,b;
        cin>>a>>b;
        a--,b--;
        if (c[a]!=c[b]){
            d[c[a]].insert(c[b]);
            d[c[b]].insert(c[a]);
        }
    }
    int mx=*clr.begin();
    for (int x: clr){
        if (d[mx].size()<d[x].size())
            mx=x;
    }
    print(mx);
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll t=1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}










