#include <bits/stdc++.h>
using std::min;
const int maxn = 100005;
int n, m, h;
int t[maxn];
struct asd {
  int a, b;
} q[maxn];
int up(int x) {
  x++;
  if (x == h)
    return 0;
  else
    return x;
}
struct qwe {
  int next, to;
} edge[maxn * 4];
int etot = 0;
int node[maxn * 2];
void add(int x, int y) {
  edge[++etot].next = node[x];
  edge[etot].to = y;
  node[x] = etot;
}
int siz[maxn];
int belong[maxn];
bool use[maxn];
int tot = 0, cnt = 0;
int dfn[maxn], low[maxn];
std::stack<int> sk;
void tarjan(int s) {
  tot++;
  dfn[s] = low[s] = tot;
  use[s] = true;
  sk.push(s);
  for (int i = node[s]; i; i = edge[i].next) {
    int too = edge[i].to;
    if (!dfn[too]) {
      tarjan(too);
      low[s] = min(low[s], low[too]);
    } else if (use[too])
      low[s] = min(low[s], dfn[too]);
  }
  if (low[s] == dfn[s]) {
    belong[s] = ++cnt;
    siz[cnt] = 1;
    use[s] = false;
    while (!sk.empty() && sk.top() != s) {
      belong[sk.top()] = cnt;
      siz[cnt]++;
      use[sk.top()] = false;
      sk.pop();
    }
    sk.pop();
  }
}
int nowval = 100000007;
;
int nowlc = 0;
int du[maxn];
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", &q[i].a, &q[i].b);
    int tp = up(t[q[i].a]);
    if (tp == t[q[i].b]) add(q[i].a, q[i].b);
    tp = up(t[q[i].b]);
    if (tp == t[q[i].a]) add(q[i].b, q[i].a);
  }
  for (int i = 1; i <= n; i++) {
    if (!dfn[i]) tarjan(i);
  }
  for (int k = 1; k <= n; k++)
    for (int i = node[k]; i; i = edge[i].next)
      if (belong[k] != belong[edge[i].to]) du[belong[k]]++;
  for (int i = 1; i <= cnt; i++)
    if (!du[i])
      if (siz[i] < nowval) nowlc = i, nowval = siz[i];
  printf("%d\n", siz[nowlc]);
  for (int i = 1; i <= n; i++)
    if (belong[i] == nowlc) printf("%d ", i);
  return 0;
}
