#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
vector<int> g[100001];
bool used[100001];
vector<int> ans;
int n, m, k;
void dfs(int v) {
  used[v] = true;
  for (size_t i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    if (!used[to]) dfs(to);
  }
  ans.push_back(v);
}
void topological_sort() {
  ans.clear();
  for (int i = 0; i < n; ++i)
    if (!used[i]) dfs(i);
  reverse(ans.begin(), ans.end());
}
int main() {
  scanf("%d %d", &n, &m);
  std::vector<int> par(n, -1);
  std::vector<std::vector<int> > ch(n);
  std::vector<std::pair<int, int> > e;
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    x--;
    y--;
    e.push_back(make_pair(x, y));
    par[y] = x;
    ch[x].push_back(y);
  }
  std::vector<int> a(n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) a[i]--;
  deque<int> ans;
  std::vector<int> u(n, 0);
  for (int i = 0; i < n; i++) {
    if (!u[i]) {
      int k = i;
      while (par[k] != -1) k = par[k];
      deque<int> q;
      if (a[k] != k) {
        cout << -1;
        return 0;
      } else {
        ans.push_front(k);
      }
      q.push_back(k);
      while (!q.empty()) {
        int v = q.front();
        q.pop_front();
        u[v] = 1;
        for (auto c : ch[v]) {
          if (a[c] == c)
            ans.push_front(c);
          else if (a[c] != a[v]) {
            cout << -1;
            return 0;
          }
          q.push_back(c);
        }
      }
    }
  }
  printf("%d\n", ans.size());
  for (auto x : ans) printf("%d\n", x + 1);
}
