#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5 + 10;
int n, m, h, ui[mx], head[mx], tot, ans, anstype;
struct node {
  int y;
  int nxt;
} Edge[mx << 1];
void AddEdge(int x, int y) {
  Edge[tot].y = y;
  Edge[tot].nxt = head[x];
  head[x] = tot++;
}
int dfn[mx], id[mx], sta[mx], size, is, out[mx];
int type[mx], typeCnt[mx], top;
bool vis[mx];
void tarjan(int x) {
  dfn[x] = id[x] = ++is;
  sta[++size] = x;
  vis[x] = 1;
  for (int i = head[x]; ~i; i = Edge[i].nxt) {
    int son = Edge[i].y;
    if (!dfn[son]) {
      tarjan(son);
      id[x] = min(id[x], id[son]);
    } else if (vis[son])
      id[x] = min(id[x], dfn[son]);
  }
  if (dfn[x] == id[x]) {
    typeCnt[++top] = 1;
    while (sta[size] != x) {
      typeCnt[top]++;
      type[sta[size]] = top;
      vis[sta[size]] = 0;
      size--;
    }
    vis[x] = 0, size--, type[x] = top;
  }
}
int main() {
  memset(head, -1, sizeof(head));
  top = size = is = tot = 0;
  ans = 1e9;
  scanf("%d%d%d", &n, &m, &h);
  for (int i = 1; i <= n; i++) scanf("%d", ui + i);
  int a, b, flag = 0;
  while (m--) {
    scanf("%d%d", &a, &b);
    if ((ui[a] + 1) % h == ui[b]) vis[a] = 1, AddEdge(a, b);
    if ((ui[b] + 1) % h == ui[a]) vis[b] = 1, AddEdge(b, a);
  }
  for (int i = 1; i <= n; i++)
    if (!vis[i]) return 0 * printf("1\n%d", i);
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) tarjan(i);
  for (int i = 1; i <= n; i++) {
    if (out[type[i]]) continue;
    for (int j = head[i]; ~j; j = Edge[j].nxt) {
      int son = Edge[j].y;
      if (type[son] != type[i]) {
        out[type[i]]++;
        break;
      }
    }
  }
  for (int i = 1; i <= top; i++)
    if (!out[i] && ans > typeCnt[i]) ans = typeCnt[i], anstype = i;
  printf("%d\n", ans);
  for (int i = 1; i <= n; i++)
    if (type[i] == anstype) printf("%d ", i);
  return puts("");
}
