#include <bits/stdc++.h>
using namespace std;
int n, m, h;
const int N = 1e5 + 10;
int A[N];
int ans[N];
int k;
int Low[N], DFN[N], Stack[N], Belong[N];
int Index, top;
int scc;
bool Instack[N];
int num[N];
int outdegree[N];
vector<int> G[N];
void init() {
  for (int i = 1; i <= n; i++) G[i].clear();
  memset(outdegree, 0, sizeof(outdegree));
}
void Tanjan(int u) {
  int v;
  Low[u] = DFN[u] = ++Index;
  Stack[top++] = u;
  Instack[u] = true;
  for (int i = 0; i < G[u].size(); i++) {
    v = G[u][i];
    if (!DFN[v]) {
      Tanjan(v);
      if (Low[u] > Low[v]) Low[u] = Low[v];
    } else if (Instack[v] && Low[u] > DFN[v])
      Low[u] = DFN[v];
  }
  if (Low[u] == DFN[u]) {
    scc++;
    do {
      v = Stack[--top];
      Instack[v] = false;
      Belong[v] = scc;
      num[scc]++;
    } while (v != u);
  }
}
void solve(int n) {
  memset(DFN, 0, sizeof(DFN));
  memset(Instack, 0, sizeof(Instack));
  memset(num, 0, sizeof(num));
  Index = scc = top = 0;
  for (int i = 1; i <= n; i++)
    if (!DFN[i]) Tanjan(i);
}
int main() {
  while (cin >> n >> m >> h) {
    init();
    for (int i = 1; i <= n; i++) cin >> A[i];
    for (int i = 0; i < m; i++) {
      int a, b;
      cin >> a >> b;
      int aa, bb;
      aa = A[a];
      bb = A[b];
      if ((aa - bb) == 1) {
        G[b].push_back(a);
      } else if ((bb - aa) == 1) {
        G[a].push_back(b);
      }
      if ((aa - bb) == (h - 1)) {
        G[a].push_back(b);
      } else if ((bb - aa) == (h - 1)) {
        G[b].push_back(a);
      }
    }
    solve(n);
    for (int u = 1; u <= n; u++) {
      int v;
      int uu, vv;
      uu = Belong[u];
      for (int j = 0; j < G[u].size(); j++) {
        v = G[u][j];
        vv = Belong[v];
        if (uu != vv) {
          outdegree[uu]++;
        }
      }
    }
    int k, cnt;
    cnt = n + 1;
    for (int i = 1; i <= scc; i++) {
      if (outdegree[i] == 0 && num[i] < cnt) {
        cnt = num[i];
        k = i;
      }
    }
    int tt = 0;
    for (int i = 1; i <= n; i++)
      if (Belong[i] == k) ans[tt++] = i;
    cout << cnt << endl;
    for (int i = 0; i < tt; i++) cout << ans[i] << (i == tt - 1 ? "\n" : " ");
  }
  return 0;
}
