#include <bits/stdc++.h>
using namespace std;
int dfn[100111], low[100111], head[100111], vis[100111], stk[100111],
    belong[100111], sz[100111];
int n, m, h, a[100111], cnt, scnt, beg, num;
int outd[100111];
struct E {
  int from, to, nxt;
} edg[2 * 100111];
void init() {
  memset(head, -1, sizeof(head));
  memset(dfn, 0, sizeof(dfn));
  memset(low, 0, sizeof(low));
  memset(belong, 0, sizeof(belong));
  memset(stk, 0, sizeof(stk));
  memset(vis, 0, sizeof(vis));
  memset(sz, 0, sizeof(sz));
  cnt = scnt = num = beg = 0;
}
void addedge(int u, int v) {
  edg[num] = {u, v, head[u]};
  head[u] = num++;
}
void tarjan(int x) {
  int v;
  dfn[x] = low[x] = ++cnt;
  stk[++beg] = x;
  for (int i = head[x]; i != -1; i = edg[i].nxt) {
    v = edg[i].to;
    if (!dfn[v]) {
      tarjan(v);
      low[x] = min(low[x], low[v]);
    } else if (!vis[v])
      low[x] = min(low[x], dfn[v]);
  }
  if (low[x] == dfn[x]) {
    scnt++;
    do {
      v = stk[beg--];
      belong[v] = scnt;
      sz[scnt]++;
      vis[v] = 1;
    } while (v != x);
  }
}
int main() {
  init();
  cin >> n >> m >> h;
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    if (a[u] < a[v]) swap(u, v);
    if (a[u] - a[v] == 1) addedge(v, u);
    if (a[u] - a[v] == h - 1) addedge(u, v);
  }
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) tarjan(i);
  for (int i = 0; i < num; ++i) {
    int u = edg[i].from, v = edg[i].to;
    if (belong[u] != belong[v]) outd[belong[u]]++;
  }
  int ans = 1e9, t;
  for (int i = 1; i <= scnt; ++i)
    if (!outd[i] && sz[i] < ans) {
      ans = sz[i];
      t = i;
    }
  printf("%d\n", ans);
  for (int i = 1; i <= n; ++i)
    if (belong[i] == t) printf("%d ", i);
  return 0;
}
