#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, F = 2147483646;
int n, m, a, b, d[N], d1[N], arr[N];
vector<int> g[N], g1[N];
bitset<N> inlist(0);
void dp(int v, int dep) {
  d1[v] = dep;
  for (int u : g1[v]) dp(u, dep + 1);
}
void dp1(int v, int dep) {
  d[v] = dep;
  for (int u : g[v]) dp1(u, dep + 1);
}
void dfs(int v, int highest) {
  if (d[arr[v]] < highest || (highest < d[arr[v]] && highest > d[v])) {
    cout << -1;
    exit(0);
  }
  highest = d[arr[v]];
  for (int u : g[v]) dfs(u, highest);
}
void solve() {
  cin >> n >> m;
  while (m--) {
    cin >> a >> b;
    a--, b--;
    g1[a].push_back(b);
    g[b].push_back(a);
  }
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
    arr[i]--;
    inlist[arr[i]] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (g[i].size() == 0) {
      dp(i, 0);
    }
  }
  for (int i = 0; i < n; i++) {
    if (g1[i].size() == 0) {
      dp1(i, 0);
      dfs(i, 0);
    }
  }
  set<pair<int, int>> ans;
  for (long long int i = 0; i < n; i++)
    if (inlist[i]) ans.insert({-d1[i], i + 1});
  cout << ans.size() << '\n';
  for (auto k : ans) cout << k.second << '\n';
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
