#include <bits/stdc++.h>
using namespace std;
inline long long gcd(long long a, long long b) {
  return (b ? gcd(b, a % b) : a);
}
inline long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
const int MAXN = 100005;
int n, m;
int pai[MAXN], desejo[MAXN], nivel[MAXN], dadoA[MAXN];
vector<int> filho[MAXN];
vector<int> ans;
void GeraNivel(int node, int nvl) {
  nivel[node] = nvl;
  for (int i = 0; i < filho[node].size(); i++) {
    GeraNivel(filho[node][i], nvl + 1);
  }
}
void dfs(int node, int man) {
  if (dadoA[node] != -1) return;
  dadoA[node] = man;
  for (int i = 0; i < filho[node].size(); i++) {
    dfs(filho[node][i], man);
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < MAXN; i++) pai[i] = i;
  for (int i = 0, x, y; i < m; i++) {
    cin >> x >> y;
    pai[y] = x;
    filho[x].push_back(y);
  }
  for (int i = 1; i <= n; i++) {
    if (pai[i] == i) GeraNivel(i, 0);
  }
  vector<pair<int, int> > v;
  for (int i = 1; i <= n; i++) {
    cin >> desejo[i];
    v.push_back(make_pair(nivel[desejo[i]], desejo[i]));
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  memset(dadoA, -1, sizeof dadoA);
  for (int i = 0; i < v.size(); i++) {
    if (dadoA[v[i].second] == -1) {
      ans.push_back(v[i].second);
      dfs(v[i].second, v[i].second);
    }
  }
  bool ok = true;
  for (int i = 1; i <= n; i++) {
    if (desejo[i] != dadoA[i]) {
      ok = false;
    }
  }
  if (ok) {
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) cout << ans[i] << "\n";
  } else {
    cout << "-1\n";
  }
}
