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.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class set{
	
	///////////////////////////////////////////////////////////////////////////
	static class FastScanner{
		BufferedReader s;
		StringTokenizer st;
		
		public FastScanner(){
			st = new StringTokenizer("");
			s = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public FastScanner(File f) throws FileNotFoundException{
			st = new StringTokenizer("");
			s = new BufferedReader (new FileReader(f));
		}
		
		public int nextInt() throws IOException{
			if(st.hasMoreTokens())
				return Integer.parseInt(st.nextToken());
			else{
				st = new StringTokenizer(s.readLine());
				return nextInt();
			}
		}
		
		public double nextDouble() throws IOException{
			if(st.hasMoreTokens())
				return Double.parseDouble(st.nextToken());
			else{
				st = new StringTokenizer(s.readLine());
				return nextDouble();
			}
		}
		
		public long nextLong() throws IOException{
			if(st.hasMoreTokens())
				return Long.parseLong(st.nextToken());
			else{
				st = new StringTokenizer(s.readLine());
				return nextLong();
			}
		}
		
		public String nextString() throws IOException{
			if(st.hasMoreTokens())
				return st.nextToken();
			else{
				st = new StringTokenizer(s.readLine());
				return nextString();
			}
			
		}
		public String readLine() throws IOException{
			return s.readLine();
		}
		
		public void close() throws IOException{
			s.close();
		}
		
	}
	
	////////////////////////////////////////////////////////////////////
	//		Number Theory
	
	long pow(long a,long b,long mod){
		long x = 1; long y = a;
		while(b > 0){
			if(b % 2 == 1){
				x = (x*y);
				x %= mod;
			}
			y = (y*y);
			y %= mod;
			b /= 2;			
		}
		return x;
	}
	
	public static int divisor(int x){
	    int limit = x;
	    int numberOfDivisors = 0;

	    for (int i=1; i < limit; ++i) {
	        if (x % i == 0) {
	            limit = x / i;
	            if (limit != i) {
	                numberOfDivisors++;
	            }
	            numberOfDivisors++;
	        }
	    }
	    return numberOfDivisors;
    }
	
	void findSubsets(int array[]){
    	
	    long numOfSubsets = 1 << array.length; 
	    for(int i = 0; i < numOfSubsets; i++){
	    		
	    	int pos = array.length - 1;
	    	int bitmask = i;

	 //      System.out.print("{");

	    	while(bitmask > 0){
	    			
	    		if((bitmask & 1) == 1)
//	   				arr[array[pos]]++;
	   			bitmask >>= 1;
	        	pos--;
	    	}
	    		
//	   		ww.println();
	   	}
	}
    
	
	public static int gcd(int a, int b){
		return b == 0 ? a : gcd(b,a%b);
	}
	
  
	public static int lcm(int a,int b, int c){
		return lcm(lcm(a,b),c);
	}
	
	public static int lcm(int a, int b){
		return a*b/gcd(a,b);
	}
	
	
	////////////////////////////////////////////////////////////////////
	
	
//	  private static  	FastScanner s = new FastScanner(new File("input.txt"));
//	  private static PrintWriter ww = new PrintWriter(new FileWriter("output.txt"));
	  private static FastScanner s = new FastScanner();   
      private static PrintWriter ww = new PrintWriter(new OutputStreamWriter(System.out));
//      private static Scanner s = new Scanner(System.in);
	@SuppressWarnings("unused")
	private static int[][] states = { {-1,0} , {1,0} , {0,-1} , {0,1} };
	
      
    //////////////////////////////////////////////////////////////////// 
      
     
    public static void main(String[] args) throws IOException{
 	//	Solution so = new Solution();
 		new set().solve();
 	}
    
    ////////////////////////////////////////////////////////////////////
    
	void solve() throws IOException{
    	
		
		int n = s.nextInt();
		int m = s.nextInt();
		int[] arr = new int[n+1];
		HashMap<Integer,HashSet<Integer>> st = new HashMap<Integer,HashSet<Integer>>();
		
		for(int i=1;i<=n;i++){
			arr[i] = s.nextInt();
			st.put(arr[i], new HashSet<Integer>());
		}
		for(int i=0;i<m;i++){
			int x = s.nextInt();
			int y = s.nextInt();
			if(arr[x] == arr[y]) continue;
			st.get(arr[x]).add(arr[y]);
			st.get(arr[y]).add(arr[x]);
		}
		
		int ans = 0;
		int max = Integer.MIN_VALUE;
		for(int i=1;i<=n;i++){
			int size = st.get(arr[i]).size();
			if(size > max){
				max = size;
				ans = arr[i];
			}else if(size == max && arr[i] < ans)
				ans = arr[i];
		}
		ww.println(ans);
		s.close();
 	    ww.close(); 
    
     }
    
}