#include <bits/stdc++.h>
using namespace std;
int const max_n = 100 * 1000 + 7;
int n, m, p[max_n], a[max_n];
vector<int> ch[max_n], vec;
void dfs(int v) {
  if (~p[v]) {
    if (a[v] != v && a[p[v]] != a[v]) {
      cout << -1 << endl;
      exit(0);
    }
  }
  for (auto u : ch[v]) dfs(u);
  if (a[v] == v) vec.push_back(v);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  memset(p, -1, sizeof p);
  for (int i = 0; i < m; i++) {
    int par, child;
    cin >> par >> child;
    par--, child--;
    ch[par].push_back(child);
    p[child] = par;
  }
  for (int i = 0; i < n; i++) cin >> a[i], a[i]--;
  for (int i = 0; i < n; i++) {
    if (p[i] == -1) dfs(i);
  }
  cout << vec.size() << '\n';
  for (auto x : vec) {
    cout << x + 1 << '\n';
  }
  return 0;
}
