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.
# import sys
# from bisect import bisect_left,bisect_right
# from collections import defaultdict as dd
# from collections import deque, Counter
# from heapq import heappop,heappush,heapify,merge
# from itertools import permutations, accumulate, product
# from math import gcd,sqrt,ceil
# toBin=lambda x:bin(x).replace("0b","")
# I=lambda:map(int,input().split())
# inf=float("inf");DIRS=[[1,0],[-1,0],[0,1],[0,-1]];CHARS="abcdefghijklmnopqrstuvwxyz";MOD=10**9+7
# ###### Fill out N to calculate combinations#####################
# # N=300010;fac=[1]*N;invfac=[1]*N
# # for i in range(2,N):fac[i]=fac[i-1]*i%MOD
# # invfac[N-1]=pow(fac[N-1],MOD-2,MOD)
# # for i in range(N-1)[::-1]:invfac[i]=invfac[i+1]*(i+1)%MOD
# # def c(i,j):return 0 if i<j else fac[i]*invfac[j]*invfac[i-j]
# ###############################################################
# input=sys.stdin.readline

class UnionFind:
    def __init__(self,n):self.p=list(range(n));self.rank=[0]*n
    def find(self,x):
        if x!=self.p[x]:self.p[x]=self.find(self.p[x])
        return self.p[x]
    def union(self,x, y):
        px,py=self.find(x),self.find(y)
        if px==py:return 0
        self.p[py]=px
        self.rank[px]+=self.rank[py]
        return 1

from types import GeneratorType
def cache(f,queue=[]):
    def wrappedfunc(*args,**kwargs):
        if queue:return f(*args, **kwargs)
        else:
            to = f(*args,**kwargs)
            while True:
                if isinstance(to,GeneratorType):queue.append(to);to = next(to)
                else:
                    if not queue:break
                    queue.pop()
                    if not queue:break
                    to=queue[-1].send(to)
            return to
    return wrappedfunc

def query(x,y):
    print("?",x,y,flush=True)
    return int(input())

# DP,BS,Greedy,Graph,Contribution,IE,Game,Reverse simulation
def main():
    """
    Since each node contributes to diversity of its neighbors with different colors,
    you can perform dfs and calculate sum of diversity for each color.
    11:30m start.
    """
    def f(x):
        for neigh in G[x]:
            if C[x] not in mp[neigh]:mp[neigh].add(C[x]);
            if neigh not in v:v.add(neigh);f(neigh)
    n,m=I();C=list(I());G={i:[] for i in range(n)};mp={i:set() for i in range(n)};v=set()
    for _ in range(m):a,b=I();a-=1;b-=1;G[a].append(b);G[b].append(a)
    for i in range(n):
        if i not in v:v.add(i);f(i)
    mx=0;res=10**6
    for node,st in mp.items():
        if len(st)>mx:res=C[node]
        elif len(st)==mx:res=min(res,C[node])
        mx=max(mx,len(st))
    print(res)


###### Comment this out for Python 3 + imports at the top #####
# if __name__ == "__main__":
#     main()

###### Uncomment this for Python 3 (for deep recursion) ######
import sys
import threading
sys.setrecursionlimit(500000);I=lambda:map(int,input().split());input=sys.stdin.readline
threading.stack_size(10**8)
t = threading.Thread(target=main)
t.start()
t.join()