#include <bits/stdc++.h>
using namespace std;
vector<int> G[100100];
vector<int> ans;
bool full[100100];
bool is[100100];
int dep[100100], want[100100];
bool cmp(const int &o, const int &p) { return dep[want[o]] > dep[want[p]]; }
void dfs(int o, int fa, int depth) {
  dep[o] = depth;
  vector<int> tmp;
  for (auto &i : G[o]) {
    dfs(i, o, depth + 1);
    tmp.push_back(i);
  }
  sort(tmp.begin(), tmp.end(), cmp);
  for (auto &i : tmp) {
    if (i == want[i]) {
      if (!full[i]) {
        full[i] = true;
        ans.push_back(i);
      }
    } else {
      if (want[i] == o) {
        if (!full[o]) {
          full[o] = true;
          ans.push_back(o);
        }
      } else {
        if (want[i] != want[o]) {
          printf("-1\n");
          exit(0);
        }
      }
    }
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    is[v] = true;
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &want[i]);
  }
  for (int i = 1; i <= n; ++i) {
    if (is[i]) continue;
    dfs(i, 0, 0);
    if (!full[i]) {
      full[i] = true;
      ans.push_back(i);
    }
  }
  cout << ans.size() << endl;
  for (auto &i : ans) {
    cout << i << endl;
  }
  return 0;
}
