#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int iinf = 1 << 29;
const long long llinf = 1ll << 60;
const double PI = 3.14159265;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
long long mrand(long long B) { return (unsigned long long)rng() % B; }
long long cross(pair<long long, long long> p1, pair<long long, long long> p2) {
  return p1.first * p2.second - p2.first * p1.second;
}
bool online(pair<long long, long long> a, pair<long long, long long> b,
            pair<long long, long long> c) {
  pair<long long, long long> p1{b.first - a.first, b.second - a.second};
  pair<long long, long long> p2{c.first - a.first, c.second - a.second};
  return cross(p1, p2) == 0;
}
void z_func(vector<int> &z, vector<int> &s, int n) {
  int L = 0, R = 0;
  for (int i = 1; i < n; i++) {
    if (i > R) {
      L = R = i;
      while (R < n && s[R - L] == s[R]) R++;
      z[i] = R - L;
      R--;
    } else {
      int k = i - L;
      if (z[k] < R - i + 1)
        z[i] = z[k];
      else {
        L = i;
        while (R < n && s[R - L] == s[R]) R++;
        z[i] = R - L;
        R--;
      }
    }
  }
}
const int MXN = 1e5 + 1;
int n, m;
bool roots[MXN];
vector<int> g[MXN];
int listt[MXN];
vector<int> ans;
void fail() {
  cout << "-1\n";
  exit(0);
}
int dfs(int node) {
  int request = -1;
  for (auto &v : g[node]) {
    int req = dfs(v);
    if (req != -1 && request != -1 && req != request) fail();
    if (req != -1) request = req;
  }
  if (request != -1 && listt[node] != request) fail();
  if (request == -1) {
    if (listt[node] == node) {
      ans.push_back(node);
      return -1;
    } else {
      return listt[node];
    }
  } else {
    if (node == listt[node]) {
      ans.push_back(node);
      return -1;
    }
    return listt[node];
  }
}
void work() {
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    roots[v] = true;
    g[u].push_back(v);
  }
  for (int i = 1; i <= n; ++i) cin >> listt[i];
  for (int i = 1; i <= n; ++i)
    if (!roots[i]) dfs(i);
  cout << ((int)(ans).size()) << "\n";
  for (auto &e : ans) cout << e << "\n";
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  work();
  return 0;
}
