#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, MOD = 1e9 + 7;
vector<int> adj[N], ans;
int A[N], sz[N], start[N], finish[N], pos[N], cntr = 0;
bool visited[N], ok = true;
set<int> S;
void dfs(int u) {
  start[u] = ++cntr;
  visited[A[u]] = 1;
  for (auto v : adj[u]) dfs(v);
  if (visited[u]) {
    ans.push_back(u);
  }
  finish[u] = ++cntr;
}
void dfs2(int u) {
  if (pos[u] != -1) S.insert(pos[u]);
  int val = *S.begin();
  if (ans[val] != A[u]) ok = 0;
  for (auto v : adj[u]) dfs2(v);
  if (pos[u] != -1) S.erase(S.find(pos[u]));
}
int main() {
  int n, m, u, v;
  cin >> n >> m;
  while (m--) {
    cin >> u >> v;
    adj[u].push_back(v);
    sz[v]++;
  }
  for (int i = 1; i <= n; i++) cin >> A[i];
  for (int i = 1; i <= n; i++) {
    if (!sz[i]) {
      dfs(i);
    }
  }
  memset(pos, -1, sizeof(pos));
  for (int i = 0; i < ans.size(); i++) pos[ans[i]] = i;
  for (int i = 1; i <= n; i++) {
    if (!sz[i]) {
      dfs2(i);
    }
  }
  if (ok) {
    cout << ans.size() << "\n";
    for (auto v : ans) cout << v << "\n";
  } else {
    cout << "-1\n";
  }
}
