#include <bits/stdc++.h>
using namespace std;
int n, m, p, q, a[100005], par[100005];
vector<int> E[100005], v, k;
map<int, int> mp;
void dfs(int nd, int pr) {
  if (a[nd] != a[pr] and a[nd] != nd) {
    cout << -1 << '\n';
    exit(0);
  }
  for (auto i : E[nd]) dfs(i, nd);
  if (mp[nd]) k.push_back(nd);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &p, &q);
    E[p].push_back(q);
    par[q] = p;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    if (par[i] == 0) v.push_back(i);
    mp[a[i]]++;
  }
  for (auto i : v) {
    a[0] = a[i];
    dfs(i, 0);
  }
  cout << k.size() << '\n';
  for (auto i : k) cout << i << '\n';
}
