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 ci.

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) = {cu : cu ≠ 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.

Input

The first line contains two space-separated integers n, m (1 ≤ n, m ≤ 105) — the number of vertices end edges of the graph, correspondingly. The second line contains a sequence of integers c1, c2, ..., cn (1 ≤ ci ≤ 105) — 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 ai, bi (1 ≤ ai, bi ≤ n; ai ≠ bi) — 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.

Output

Print the number of the color which has the set of neighbours with the maximum cardinality. It there are multiple optimal colors, print the color with the minimum number. Please note, that you want to find such color, that the graph has at least one vertex with such color.

Examples

Input

6 6
1 1 2 3 5 8
1 2
3 2
1 4
4 3
4 5
4 6


Output

3


Input

5 6
4 2 5 2 4
1 2
2 3
3 1
5 3
5 4
3 4


Output

2
import java.io.* ;
import java.util.*;

import static java.lang.Math.* ;
import static java.util.Arrays.* ;

public class E {
	
	public static void main(String[] args) throws IOException {
		
		new E().solveProblem();
		
		out.close();
	}

	static Input in = new Input() ;
	static PrintStream out = new PrintStream(new BufferedOutputStream(System.out));	
	static Output out2 = new Output(out) ;
	
	
	int MAX = 100001;
	public void solveProblem() throws IOException {		
	

	    int n = in.nextInt();
	    int m = in.nextInt();
	    
	    int fc = Integer.MAX_VALUE;;
	    int[] c = in.nextInt(n);
	    ArrayList<Integer>[] map = new ArrayList[MAX+1];
	    for( int i = 0; i <= MAX ; i++)
	        map[i] = new ArrayList<Integer>();
	    for( int cc : c)
	        fc = min(cc,fc);
	    for( int i = 0; i < m ; i++){
	        int u  =in.nextInt()-1;
	        int v = in.nextInt()-1;
	        if( c[u] != c[v]){
    	        map[c[u]].add(c[v]);
    	        map[c[v]].add(c[u]);
	        }
	    }
	    
	   
	    int max = 0;
	    int res = -1;
	    int[] last = new int[MAX+1];
	    fill(last,-1);
	    for( int i = 0; i <= MAX; i++){
	        
	        int t = 0;
	        for( int nb : map[i]){
	            if( last[nb] < i )
	                t++;
	            last[nb] = i;
	        }
	        if(t > max){
	            max =t;
	            res = i;
	        }
	    }
	    out.println(max == 0 ? fc : res);
		
	}
	
	static void p( Object ...p){
		System.out.println(Arrays.deepToString(p));
	}
	
	static class Input {	
		
		BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer tokens ;
		
		public int nextInt(){
			return Integer.parseInt(next()) ;
		}

		public int[] nextInt(int n ){
			int[] res = new int[n] ;
			for( int i = 0 ; i < n ; i++ )
				res[i] = nextInt() ;
			return res ;
		}

		public long nextLong(){
			return Long.parseLong(next()) ;
		}

		public long[] nextLong(int n ){
			long[] res = new long[n] ;
			for( int i = 0 ; i < n ; i++ )
				res[i] = nextLong() ;
			return res ;
		}
		
		public double nextDouble(){
			return Double.parseDouble(next()) ;
		}
		
		public String next(){
			
			try{
				while( tokens == null || !tokens.hasMoreTokens() )
					tokens = new StringTokenizer(buf.readLine()) ;
			}catch( Exception e ){
				e.printStackTrace() ;
			}
			
			return tokens.nextToken() ;
		}
		
		public String nextLine(){
		    try {
                return buf.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
		    return null;
		}

	}

	static class Output {
		
		PrintStream out ;
		
		public Output(PrintStream out) {
			this.out = out;
		}

		void wr( int[] rij ){
			for( int i = 0 ; i < rij.length - 1 ; i++ ) 
				out.print(rij[i] + " ") ;
			out.println(rij[rij.length-1]);		
		}

		void wr( long[] rij ){
			for( int i = 0 ; i < rij.length - 1 ; i++ ) 
				out.print(rij[i] + " ") ;
			out.println(rij[rij.length-1]);		
		}
		
		void wr( char[] rij){
			out.println(new String(rij)) ;
		}
		
	}
}
