#include <bits/stdc++.h>
using namespace std;
vector<int> children[100005];
bool isChild[100005];
int depth[100005];
vector<int> roots;
vector<int> ans;
int gift[100005];
int check[100005];
void dfs(int v, int d) {
  depth[v] = d;
  for (auto c : children[v]) dfs(c, d + 1);
}
int dfs2(int v) {
  int h;
  int curr = depth[gift[v]];
  for (auto c : children[v]) {
    h = dfs2(c);
    if (h == -1) {
      return -1;
    } else if (h != 0) {
      if (curr != h) {
        curr = -1;
      }
    }
  }
  if (curr == depth[v]) {
    curr = 0;
    check[v] = 1;
  }
  return curr;
}
void dfs3(int v) {
  for (auto c : children[v]) dfs3(c);
  if (check[v]) {
    ans.push_back(v);
  }
}
int main() {
  int n, m, p, q;
  scanf("%d %d", &n, &m);
  while (m--) {
    scanf("%d %d", &p, &q);
    isChild[q] = 1;
    children[p].push_back(q);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &gift[i]);
  }
  int h;
  for (int i = 1; i <= n; i++)
    if (!isChild[i]) {
      roots.push_back(i);
      dfs(i, 1);
      h = dfs2(i);
      if (h == -1) {
        cout << -1 << endl;
        return 0;
      }
      dfs3(i);
    }
  cout << ans.size() << endl;
  for (auto i : ans) cout << i << endl;
  return 0;
}
