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.
# author : Tapan Goyal
#           MNIT Jaipur

import math
import bisect
import itertools
import sys
I=lambda : sys.stdin.readline()
one=lambda : int(I())
more=lambda : map(int,I().split())
linput=lambda : list(more())

mod=10**9 +7
inf=10**18 + 1 

'''fact=[1]*100001
ifact=[1]*100001
for i in range(1,100001):
    fact[i]=((fact[i-1])*i)%mod
    ifact[i]=((ifact[i-1])*pow(i,mod-2,mod))%mod
def ncr(n,r):
    return (((fact[n]*ifact[n-r])%mod)*ifact[r])%mod
def npr(n,r):
    return (((fact[n]*ifact[n-r])%mod))
    '''


def merge(a,b):
    i=0;j=0
    c=0
    ans=[]
    while i<len(a) and j<len(b):
        if a[i]<b[j]:
            ans.append(a[i])
            i+=1
        else:
            ans.append(b[j])
            c+=len(a)-i
            j+=1
    ans+=a[i:]
    ans+=b[j:]
    return ans,c
def mergesort(a):
    if len(a)==1:
        return a,0
    mid=len(a)//2   
    left,left_inversion=mergesort(a[:mid])
    right,right_inversion=mergesort(a[mid:])
    m,c=merge(left,right)
    c+=(left_inversion+right_inversion)
    return m,c
    
def is_prime(num):
    if num == 1: return False
    if num == 2: return True
    if num == 3: return True
    if num%2 == 0: return False
    if num%3 == 0: return False
    t = 5
    a = 2
    while t <= int(math.sqrt(num)):
        if num%t == 0: return False
        t += a
        a = 6 - a
    return True

  
def ceil(a,b):
    return (a+b-1)//b
    


#/////////////////////////////////////////////////////////////////////////////////////////////////
if __name__ == "__main__":
    n,m=more()
    color=[0] + linput()
    a=[set() for i in range(n+1)]
    for i in range(m):
        x,y=more()
        a[x].add(color[y])
        a[y].add(color[x])
    ans=0
    col=10**12
    # print(a)
    for i in range(1,n+1):
        if color[i] in a[i]:
            if ans<len(a[i]) - 1:
                ans=max(ans,len(a[i]) - 1)
                col=color[i]
            elif ans==len(a[i]) - 1:
                col=min(color[i],col)
                
        else:
            if ans<len(a[i]):
                col=color[i]
                ans=max(ans,len(a[i]))
            elif ans==len(a[i]):
                col=min(color[i],col)
                
    print(col)        
        