#include <bits/stdc++.h>
using namespace std;
int n, m, p, q, par[123456], trg[123456];
vector<int> al[123456];
vector<int> ans;
void go(int at) {
  for (int to : al[at]) go(to);
  if (trg[at] == at)
    ans.push_back(at);
  else if (trg[at] != trg[par[at]]) {
    puts("-1");
    exit(0);
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = (0); i < (m); i++) {
    scanf("%d %d", &p, &q);
    par[q] = p;
    al[p].push_back(q);
  }
  for (int i = (1); i < (n + 1); i++) scanf("%d", trg + i);
  for (int i = (1); i < (n + 1); i++)
    if (par[i] == 0) go(i);
  printf("%d\n", ans.size());
  for (int i : ans) printf("%d\n", i);
  return 0;
}
