#include <bits/stdc++.h>
using namespace std;
int dfn[100009], low[100009], head[100009], tot, cnt, num, st[100009], top, x,
    nu[100009], n, m, t[100009], a, b, h, c[100009], du[100009], ans, ji;
bool vis[100009];
struct fef {
  int n, to, u;
} an[100009 << 1];
inline void add(int u, int v) {
  an[++tot].n = head[u];
  an[tot].to = v;
  head[u] = tot;
  an[tot].u = u;
}
void tarjan(int u) {
  vis[u] = 1;
  st[++top] = u;
  dfn[u] = low[u] = ++cnt;
  for (int i = head[u]; i; i = an[i].n) {
    int v = an[i].to;
    if (!dfn[v]) {
      tarjan(v);
      low[u] = min(low[u], low[v]);
    } else if (vis[v])
      low[u] = min(low[u], dfn[v]);
  }
  if (low[u] == dfn[u]) {
    num++;
    do {
      x = st[top--];
      vis[x] = 0;
      nu[num]++;
      c[x] = num;
    } while (x != u);
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &h);
  for (int i = 1; i <= n; ++i) scanf("%d", &t[i]);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &a, &b);
    if ((t[a] + 1) % h == t[b]) add(a, b);
    if ((t[b] + 1) % h == t[a]) add(b, a);
  }
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) tarjan(i);
  for (int i = 1; i <= tot; ++i)
    if (c[an[i].u] != c[an[i].to]) du[c[an[i].u]]++;
  ans = 0x3f3f3f3f;
  for (int i = 1; i <= num; ++i)
    if (!du[i] && nu[i] < ans) {
      ans = nu[i];
      ji = i;
    }
  cout << ans << endl;
  for (int i = 1; i <= n; ++i)
    if (c[i] == ji) printf("%d ", i);
  return 0;
}
