#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
const int INF = 1e9;
int n, m, h, a[N];
vector<int> adj[N];
int num[N], low[N], Time, root[N], sz[N];
stack<int> st;
void tarjan(int u) {
  num[u] = low[u] = ++Time;
  st.push(u);
  for (int v : adj[u])
    if (!num[v]) {
      tarjan(v);
      low[u] = min(low[u], low[v]);
    } else {
      low[u] = min(low[u], num[v]);
    }
  if (low[u] == num[u])
    while (1) {
      int v = st.top();
      st.pop();
      root[v] = u;
      sz[u]++;
      num[v] = low[v] = INF;
      if (v == u) break;
    }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> h;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    if ((a[u] + 1) % h == a[v]) adj[u].push_back(v);
    if ((a[v] + 1) % h == a[u]) adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++)
    if (!num[i]) tarjan(i);
  for (int u = 1; u <= n; u++)
    for (int v : adj[u])
      if (root[v] != root[u]) num[root[u]] = 0;
  int best = 0;
  sz[0] = INF;
  for (int i = 1; i <= n; i++)
    if (root[i] == i && num[i] == INF && sz[best] > sz[i]) best = i;
  assert(best > 0);
  cout << sz[best] << '\n';
  for (int i = 1; i <= n; i++)
    if (root[i] == best) cout << i << ' ';
  return 0;
}
