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.*;;

public class Solution {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		Task task = new Task();
		int t = 1;
		for (int i = 1; i <= t; i++) task.solve(i, in, out);
		out.close();
	}

	static class Task {
 		
		public void solve(int testNumber, InputReader in, OutputWriter out) throws IOException {
			int n = in.nextInt(), m = in.nextInt();
			int[] col = in.nextIntArray(n + 1, 1);
			int size = -1, min = Integer.MAX_VALUE;
			for (int i = 1; i <= n; i++) {
				size = Math.max(size, col[i]);
				min = Math.min(min, col[i]);
			}
			ArrayList<TreeSet<Integer>> g = new ArrayList<>();
			for (int i = 0; i <= size; i++) g.add(new TreeSet<>());
			boolean f = false;
			while (m-- > 0) {
				int a = in.nextInt(), b = in.nextInt();
				int c1 = col[a], c2 = col[b];
				if (c1 != c2) {
					TreeSet<Integer> t = g.get(c1);
					t.add(c2);
					t = g.get(c2);
					t.add(c1);
					f = true;
				}
			}
			if (f) {
				int max = -1, maxC = -1;
				for (int i = 1; i<= size; i++) {
					if (g.get(i).size() > max) {
						max = g.get(i).size();
						maxC = i;
					}
				}
				out.println(maxC, "\n");
			}
			else out.println(min, "\n");
 		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}
		
		private void tokenize() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}

		public String next() {
			tokenize();
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}
		
		public char nextChar() {
			return next().charAt(0);
		}
		
		public float nextFloat() {
			return Float.parseFloat(next());
		}
		
		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int size, int a) {
			tokenize();
			int[] arr=new int[size];
			for(int i = a; i < size; i++) {
				tokenize();
				arr[i] = Integer.parseInt(tokenizer.nextToken());
			}
			return arr;
		}
		
		public long[] nextLongArray(int size, int a) {
			tokenize();
			long[] arr=new long[size];
			for(int i = a; i < size; i++) {
				tokenize();
				arr[i] = Long.parseLong(tokenizer.nextToken());
			}
			return arr;
		}
		
		public float[] nextFloatArray(int size, int a) {
			tokenize();
			float[] arr=new float[size];
			for(int i = a; i < size; i++) {
				tokenize();
				arr[i] = Float.parseFloat(tokenizer.nextToken());
			}
			return arr;
		}

		public double[] nextDoubleArray(int size, int a) {
			tokenize();
			double[] arr=new double[size];
			for(int i = a; i < size; i++) {
				tokenize();
				arr[i] = Double.parseDouble(tokenizer.nextToken());
			}
			return arr;
		}

		public String[] nextStringArray(int size, int a) throws IOException {
			String[] arr=new String[size];
			for(int i = a; i < size; i++) 
				arr[i] = reader.readLine();
			return arr;
		}

		public char[] nextCharArray(int size) throws IOException {
			return reader.readLine().toCharArray();
		}
	}

	static class OutputWriter {
		public PrintWriter pw;

		public OutputWriter(OutputStream stream) {
			pw = new PrintWriter(stream);
		}
		
		public void println(Object... obj) {
			if (obj.length == 0) pw.println();
			else {
				String delimiter = (String) obj[obj.length - 1];
				for (int i = 0 ; i < obj.length - 1; i++) pw.print(obj[i] + delimiter);
			}
		}

		public void close() {
			pw.close();
		}

		public void flush() {
			pw.flush();
		}

		public void printStringArray(String[] arr, int a, int b) {
			for(int i = a; i < b; i++)
				pw.println(arr[i]);
		}
		
		public void printBooleanArray(boolean[] arr, int a, int b) {
			for(int i = a; i < b; i++)
				pw.print(arr[i] + " ");
		}

		public void printIntArray(int[] arr, int a, int b) {
			for(int i = a; i < b; i++)
				pw.print(arr[i] + " ");
		}

		public void printLongArray(long[] arr, int a, int b) {
			for(int i = a; i < b; i++)
				pw.print(arr[i] + " ");
		}

		public void printCharArray(char[] arr, int a, int b) {
			for(int i = a; i < b; i++)
				pw.print(arr[i] + " ");
		}

		public void printFloatArray(float[] arr, int a, int b) {
			for(int i = a; i < b; i++)
				pw.print(arr[i] + " ");
		}

		public void printDoubleArray(double[] arr, int a, int b) {
			for(int i = a; i < b; i++)
				pw.print(arr[i] + " ");
		}
		
		public void printIntArrayList(ArrayList<Integer> arr, int a, int b) {
			for(int i = a; i < b; i++)
				pw.print(arr.get(i) + " ");
		}
		
		public void printLongArrayList(ArrayList<Long> arr, int a, int b) {
			for(int i = a; i < b; i++)
				pw.print(arr.get(i) + " ");
		}
	}
}