#include <bits/stdc++.h>
using namespace std;
vector<int> graph[100010];
int parents[100010];
vector<int> result;
int giftto[100010];
int targets[100010];
void visit(int node) {
  for (auto i : graph[node]) {
    visit(i);
  }
  if (targets[node]) {
    result.push_back(node);
  }
  targets[node] = 0;
}
int main() {
  int n, m;
  cin >> n >> m;
  int p, s;
  for (int i = 0; i < m; i++) {
    cin >> p >> s;
    parents[s] = p;
    graph[p].push_back(s);
  }
  int target;
  for (int i = 1; i <= n; i++) {
    cin >> target;
    targets[target] = 1;
    int cur = i;
    while (cur) {
      if (giftto[cur] && giftto[cur] != target) {
        cout << -1 << endl;
        return 0;
      }
      giftto[cur] = target;
      if (target == cur) {
        break;
      }
      cur = parents[cur];
    }
  }
  for (int i = 1; i <= n; i++) {
    if (targets[i]) {
      visit(i);
    }
  }
  cout << result.size() << endl;
  for (auto i : result) {
    cout << i << endl;
  }
  return 0;
}
