#include <bits/stdc++.h>
using namespace std;
vector<long long> v[200005];
long long ch[200005], par[200005], dep[200005], x[200005], yes[200005],
    dp[200005];
void dfs(int p, int s) {
  dep[p] = s;
  for (auto it : v[p]) {
    dfs(it, s + 1);
  }
}
void dfs2(int p, int s) {
  s += yes[p];
  dp[p] = s;
  for (auto it : v[p]) {
    dfs2(it, s);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a = 0, b = 0, c, d, e, f = 0, l, g, m, n, k, i, j, t, p, q;
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    cin >> a >> b;
    v[a].push_back(b);
    ch[a]++;
    par[b]++;
  }
  for (i = 1; i <= n; i++) {
    if (par[i] == 0) {
      dfs(i, 0);
    }
  }
  set<pair<long long, long long> > st;
  for (i = 1; i <= n; i++) {
    cin >> x[i];
    st.insert({-1 * dep[x[i]], x[i]});
  }
  for (auto it : st) {
    yes[it.second] = 1;
  }
  for (i = 1; i <= n; i++) {
    if (par[i] == 0) {
      dfs2(i, 0);
    }
  }
  f = 1;
  for (i = 1; i <= n; i++) {
    if (dp[i] != dp[x[i]]) f = 0;
  }
  if (!f)
    cout << -1 << '\n';
  else {
    cout << st.size() << '\n';
    for (auto it : st) cout << it.second << '\n';
  }
  return 0;
}
