#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> g[N];
int n, a[N];
vector<int> res;
int parent[N];
bool check() {
  for (int i = 1; i <= n; i++)
    if (parent[i] != 0)
      if (a[i] != i && a[i] != parent[i] && a[i] != a[parent[i]]) return 0;
  return 1;
}
bool dfs(int x) {
  for (int i = 0; i < g[x].size(); i++) {
    int v = g[x][i];
    dfs(v);
  }
  if (a[x] == x) res.push_back(x);
}
int main() {
  ios::sync_with_stdio(0);
  ;
  int m;
  cin >> n >> m;
  while (m--) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    parent[y] = x;
  }
  for (int i = 1; i <= n; i++) cin >> a[i];
  if (!check()) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 1; i <= n; i++)
    if (parent[i] == 0) dfs(i);
  cout << res.size() << endl;
  for (int i = 0; i < res.size(); i++) cout << res[i] << endl;
  return 0;
}
