#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100050;
long long inp1, inp2, inp3;
long long n, m, head[MAXN], give[MAXN], ind[MAXN], cnt = 1;
queue<long long> stk;
struct EDGE {
  long long to, nxt;
} edge[MAXN * 2];
void add_edge(long long u, long long v) {
  edge[++cnt].to = v;
  edge[cnt].nxt = head[u];
  head[u] = cnt;
}
void dfs(long long u, long long fa) {
  for (long long i = head[u]; i; i = edge[i].nxt) {
    long long v = edge[i].to;
    dfs(v, u);
  }
  if (give[u] != u && give[u] != give[fa]) {
    printf("-1");
    exit(0);
  }
  if (give[u] == u) stk.push(u);
}
int main() {
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= m; i++) {
    scanf("%lld%lld", &inp1, &inp2);
    add_edge(inp1, inp2);
    ind[inp2]++;
  }
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &give[i]);
  }
  for (long long i = 1; i <= n; i++) {
    if (!ind[i]) dfs(i, 0);
  }
  printf("%lld\n", (long long)stk.size());
  while (!stk.empty()) {
    printf("%lld\n", stk.front());
    stk.pop();
  }
  return 0;
}
