#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, m, h, u[maxn];
int tot, fro[2 * maxn], go[2 * maxn], nxt[2 * maxn], f1[maxn];
void ins(int x, int y) {
  fro[++tot] = x;
  go[tot] = y;
  nxt[tot] = f1[x];
  f1[x] = tot;
}
int sum, dfn[maxn], low[maxn], z[maxn], z0, bz[maxn], rt[maxn], num[maxn];
void tarjan(int k) {
  dfn[k] = low[k] = ++sum;
  bz[k] = 1;
  z[++z0] = k;
  for (int p = f1[k]; p; p = nxt[p])
    if (!bz[go[p]]) {
      tarjan(go[p]);
      low[k] = min(low[k], low[go[p]]);
    } else if (bz[go[p]] == 1)
      low[k] = min(low[k], dfn[go[p]]);
  if (dfn[k] == low[k]) {
    do {
      bz[z[z0]] = 2;
      rt[z[z0]] = k;
      num[k]++;
    } while (z[z0--] != k);
  }
}
int cd[maxn];
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++) {
    int x, y;
    scanf("%d %d", &x, &y);
    if ((u[x] + 1) % h == u[y]) ins(x, y);
    if ((u[y] + 1) % h == u[x]) ins(y, x);
  }
  for (int i = 1; i <= n; i++)
    if (!bz[i]) tarjan(i);
  for (int p = 1; p <= tot; p++)
    if (rt[fro[p]] != rt[go[p]]) cd[rt[fro[p]]]++;
  int ans = n + 1, wz = 0;
  for (int i = 1; i <= n; i++)
    if (rt[i] == i && !cd[i] && num[i] < ans) ans = num[i], wz = i;
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++)
    if (rt[i] == wz) printf("%d ", i);
}
