#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int n, m, u, v;
int par[N], a[N], flag[N];
vector<int> g[N], ans;
queue<int> q;
void dfs(int v, int head) {
  if (a[v] == v) head = v;
  if (a[v] != head) {
    puts("-1");
    exit(0);
  }
  for (auto u : g[v]) dfs(u, head);
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    par[v] = u;
  }
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i)
    if (!par[i]) dfs(i, a[i]);
  for (int i = 1; i <= n; ++i) flag[a[i]] = 1;
  for (int i = 1; i <= n; ++i) {
    if (par[i]) continue;
    q.push(i);
    while (!q.empty()) {
      v = q.front();
      q.pop();
      if (flag[v]) ans.push_back(v);
      for (auto u : g[v]) q.push(u);
    }
  }
  reverse(ans.begin(), ans.end());
  printf("%d\n", ans.size());
  for (auto i : ans) printf("%d\n", i);
  return 0;
}
