#include <bits/stdc++.h>
using namespace std;
vector<int> e[100005];
bool visited[100005];
int to[100005];
int indeg[100005];
vector<int> ord;
vector<int> res;
pair<bool, int> dfs(int root) {
  visited[root] = true;
  int h = to[root];
  if (e[root].empty()) {
    if (root == to[root]) ord.push_back(root);
    return make_pair(true, to[root]);
  } else {
    bool f1 = true;
    for (auto t : e[root]) {
      auto p1 = dfs(t);
      if (!p1.first) f1 = false;
      if (p1.second != t && p1.second != h) f1 = false;
    }
    if (!f1)
      return make_pair(false, -1);
    else {
      if (root == h) ord.push_back(root);
      return make_pair(true, h);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  bool flag = true;
  for (int i = 0; i < m; ++i) {
    int p, q;
    cin >> p >> q;
    e[p].push_back(q);
    ++indeg[q];
  }
  for (int i = 1; i <= n; ++i) cin >> to[i];
  for (int i = 1; i <= n; ++i) {
    ord.clear();
    if (!visited[i] && !indeg[i]) flag = dfs(i).first;
    if (!flag) break;
    for (auto id : ord) {
      res.push_back(id);
    }
  }
  if (!flag)
    cout << -1 << endl;
  else {
    cout << res.size() << endl;
    for (auto i : res) cout << i << endl;
  }
  return 0;
}
