#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int N, M;
vector<int> AdjList[MAXN];
int depth[MAXN], par[MAXN], in[MAXN], out[MAXN], id[MAXN];
int dat[MAXN], order[MAXN], must[MAXN];
bool checked[MAXN], pushed[MAXN];
vector<int> ans;
int cntr;
bool comp(int A, int B) { return depth[dat[A]] > depth[dat[B]]; }
void DFS(int cur, int _depth) {
  in[cur] = ++cntr;
  id[cntr] = cur;
  depth[cur] = _depth;
  for (int i = 0; i < (int)(AdjList[cur]).size(); i++) {
    int nxt = AdjList[cur][i];
    if (nxt == par[cur]) continue;
    par[nxt] = cur;
    DFS(nxt, _depth + 1);
  }
  out[cur] = cntr;
}
void Merge(int x) {
  int i = in[x];
  while (i <= out[x]) {
    if (checked[id[i]]) {
      i = out[id[i]] + 1;
      continue;
    }
    checked[id[i]] = true;
    must[id[i]] = x;
    ++i;
  }
}
int main() {
  scanf("%d %d", &N, &M);
  int u, v;
  for (int i = 0; i < M; i++) {
    scanf("%d %d", &u, &v);
    AdjList[u].push_back(v);
    AdjList[v].push_back(u);
    par[v] = u;
  }
  for (int i = 1; i <= N; i++) scanf("%d", &dat[i]);
  for (int i = 1; i <= N; i++) {
    order[i] = i;
    if (par[i] == 0) {
      DFS(i, 0);
    }
  }
  sort(order + 1, order + 1 + N, comp);
  for (int i = 1; i <= N; i++) {
    int cur = order[i];
    if (checked[cur]) {
      if (dat[cur] != must[cur]) {
        printf("-1\n");
        return 0;
      } else
        continue;
    }
    Merge(dat[cur]);
    if (!pushed[dat[cur]]) {
      ans.push_back(dat[cur]);
      pushed[dat[cur]] = true;
    }
  }
  printf("%d\n", (int)(ans).size());
  for (int i = 0; i < (int)(ans).size(); i++) printf("%d\n", ans[i]);
  return 0;
}
