#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 100;
const int INF = 2147000000;
vector<int> G[maxn];
vector<int> SCC[maxn];
int u[maxn], c[maxn][2];
int in[maxn];
int n, m, h;
int pre[maxn], lowlink[maxn], sccno[maxn], dfs_clock, scc_cnt;
stack<int> S;
void dfs(int u) {
  pre[u] = lowlink[u] = ++dfs_clock;
  S.push(u);
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (!pre[v]) {
      dfs(v);
      lowlink[u] = min(lowlink[u], lowlink[v]);
    } else if (!sccno[v]) {
      lowlink[u] = min(lowlink[u], pre[v]);
    }
  }
  if (lowlink[u] == pre[u]) {
    scc_cnt++;
    SCC[scc_cnt].clear();
    for (;;) {
      int x = S.top();
      S.pop();
      sccno[x] = scc_cnt;
      SCC[scc_cnt].push_back(x);
      if (x == u) break;
    }
  }
}
void find_scc(int n) {
  dfs_clock = scc_cnt = 0;
  memset(sccno, 0, sizeof(sccno));
  memset(pre, 0, sizeof(pre));
  for (int i = 1; i <= n; i++)
    if (!pre[i]) dfs(i);
}
int main() {
  scanf("%d%d%d", &n, &m, &h);
  for (int i = 1; i <= n; i++) scanf("%d", &u[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &c[i][0], &c[i][1]);
    if (u[c[i][0]] > u[c[i][1]]) swap(c[i][0], c[i][1]);
    if (u[c[i][0]] + 1 == u[c[i][1]]) G[c[i][0]].push_back(c[i][1]);
    if (u[c[i][0]] == 0 && u[c[i][1]] == h - 1) G[c[i][1]].push_back(c[i][0]);
  }
  find_scc(n);
  int ans = 0;
  int Min = INF;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < G[i].size(); j++) {
      int v = G[i][j];
      if (sccno[i] != sccno[v]) in[sccno[i]]++;
    }
  }
  for (int i = 1; i <= scc_cnt; i++) {
    if (!in[i]) {
      if (Min > SCC[i].size()) {
        Min = SCC[i].size();
        ans = i;
      }
    }
  }
  printf("%d\n", Min);
  for (int i = 0; i < SCC[ans].size(); i++) printf("%d ", SCC[ans][i]);
  return 0;
}
