#include <bits/stdc++.h>   using namespace std;   vector<double> E[100010];   int color[100010];   int seen[100010];   set<int> sets[100010];   void dfs(int u) {     for (int i = 0; i < E[u].size(); ++i) {       int v = E[u][i];       if (color[u] != color[v]) sets[color[u]].insert(color[v]);       if (!seen[v]) {         seen[v] = true;         dfs(v);       }     }   }   int main() {     int n, m, u, v;     cin >> n >> m;     set<int> colorids;     for (int i = 0; i < n; ++i) {       cin >> color[i];       colorids.insert(color[i]);     }     for (int i = 0; i < m; ++i) {       cin >> u >> v;       --u;       --v;       E[u].push_back(v);       E[v].push_back(u);     }     memset(seen, 0, sizeof(seen));     for (int i = 0; i < n; ++i)       if (!seen[i]) {         seen[i] = true;         dfs(i);       }     int maxcolor = -1;     int maxn = -(1 << 30);     for (typeof(colorids.begin()) it = colorids.begin(); it != colorids.end();          ++it) {       int color = *it;       int ncolors = sets[*it].size();       if (maxn < ncolors) {         maxn = ncolors;         maxcolor = *it;       }     }     cout << maxcolor << endl;     return 0;   }   