#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
int n;
vector<int> order, ans;
vector<char> seen;
void dfs(int u) {
  seen[u] = true;
  for (int v : adj[u])
    if (!seen[v]) dfs(v);
  order.push_back(u);
}
void topSort() {
  seen.assign(n, false);
  for (int i = 0; i < n; i++) {
    if (!seen[i]) dfs(i);
  }
}
void dfs2(int u, int as) {
  ans[u] = as;
  for (int v : adj[u])
    if (ans[v] == -1) dfs2(v, as);
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  int i, j, m, u, v;
  cin >> n >> m;
  vector<int> dish(n);
  adj.resize(n);
  for (i = 0; i < m; i++) {
    cin >> u >> v;
    adj[u - 1].push_back(v - 1);
  }
  for (i = 0; i < n; i++) {
    cin >> dish[i];
    dish[i]--;
  }
  topSort();
  vector<char> used(n, false);
  for (i = 0; i < n; i++) used[dish[i]] = true;
  vector<int> out;
  ans.assign(n, -1);
  for (int od : order)
    if (used[od]) {
      dfs2(od, od);
      out.push_back(od);
    }
  for (int i = 0; i < n; i++) {
    if (ans[i] != dish[i]) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << out.size() << endl;
  for (int od : out) cout << od + 1 << endl;
}
