#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
const long long INF = 1e18;
long long power(long long x, long long y) {
  long long t = 1;
  while (y > 0) {
    if (y % 2)
      y -= 1, t = t * x % mod;
    else
      y /= 2, x = x * x % mod;
  }
  return t;
}
vector<int> G[N];
int b[N];
int arr[N], a[N], par[N];
set<int> dn;
map<int, int> M;
int tl = 0;
int ans[N], f = 0, k[N];
void dfs(int v) {
  for (int i = 0; i < G[v].size(); ++i) dfs(G[v][i]);
  if (a[v]) ans[tl++] = v, k[v] = tl - 1;
}
void dfs2(int v, int x) {
  if (a[v]) x = min(x, k[v]);
  if (x != k[b[v]]) f = 1;
  for (int i = 0; i < G[v].size(); ++i) dfs2(G[v][i], x);
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  memset(par, -1, sizeof(par));
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--;
    y--;
    par[y] = x;
    G[x].push_back(y);
  }
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    x--;
    a[x]++;
    b[i] = x;
  }
  for (int i = 0; i < n; ++i)
    if (par[i] == -1) {
      dfs(i);
    }
  for (int i = 0; i < n; ++i)
    if (par[i] == -1) {
      dfs2(i, mod);
    }
  if (f == 1)
    printf("-1\n");
  else {
    printf("%d\n", tl);
    for (int i = 0; i < tl; ++i) printf("%d\n", ans[i] + 1);
  }
  return 0;
}
