#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 6;
int N, M;
int p[MAXN], a[MAXN], b[MAXN];
vector<int> G[MAXN];
bool want[MAXN], good = true;
void go_up(int u, int w) {
  if (b[u] != -1) {
    if (b[u] != w) {
      good = false;
    }
    return;
  }
  b[u] = w;
  if (u != w) go_up(p[u], w);
}
int main() {
  scanf("%d %d", &N, &M);
  memset(p, -1, sizeof(p));
  memset(a, -1, sizeof(a));
  memset(b, -1, sizeof(b));
  for (int i = 0; i < M; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    G[u].push_back(v);
    p[v] = u;
  }
  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
    a[i]--;
    want[a[i]] = true;
  }
  for (int u = 0; u < N; u++) {
    if (a[u] != -1) go_up(u, a[u]);
  }
  if (!good) {
    printf("-1\n");
    return 0;
  }
  queue<int> q;
  vector<int> ans;
  for (int i = 0; i < N; i++)
    if (p[i] == -1) q.push(i);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    if (want[u]) ans.push_back(u);
    for (int i = 0; i < G[u].size(); i++) q.push(G[u][i]);
  }
  printf("%d\n", ans.size());
  for (int i = ans.size() - 1; i > -1; i--) printf("%d\n", ans[i] + 1);
}
