#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1000000000")
using namespace std;
int c[100010], n, m;
set<int> s[100010];
int x[100010], y[100010], ans;
int main() {
  scanf("%d%d", &n, &m);
  ans = 1000000007;
  for (int i = 1; i <= n; ++i) scanf("%d", &c[i]), ans = min(ans, c[i]);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &x[i], &y[i]);
    if (c[y[i]] != c[x[i]]) {
      s[c[x[i]]].insert(c[y[i]]);
      s[c[y[i]]].insert(c[x[i]]);
    }
  }
  for (int i = 1; i <= 1e5; ++i)
    if (s[i].size() > s[ans].size()) ans = i;
  cout << ans << endl;
}
