#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
vector<int> child[N];
int par[N], a[N];
bool flag = true;
vector<int> l;
void dfs(int v) {
  for (auto u : child[v]) {
    dfs(u);
    if (a[u] != -1 && a[u] != a[v]) flag = false;
  }
  if (a[v] == v) {
    l.push_back(v);
    a[v] = -1;
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  memset(par, -1, sizeof par);
  for (int i = 0; i < m; i++) {
    int p, q;
    cin >> p >> q;
    child[--p].push_back(--q);
    par[q] = p;
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    a[i]--;
  }
  for (int i = 0; i < n; i++)
    if (par[i] == -1) dfs(i);
  if (!flag) {
    cout << "-1\n";
    return 0;
  }
  cout << l.size() << "\n";
  for (auto x : l) cout << x + 1 << "\n";
  return 0;
}
