#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
vector<vector<int> > tree;
vector<vector<int> > want;
int dep[1000010], st[1000010], en[1000010];
bool nroot[1000010];
bool can = true;
pair<int, int> seg[5000010];
int ti;
set<pair<int, int> > sol;
set<int> cur;
void dfs(int ind) {
  stack<pair<int, int> > s;
  s.push({ind, 0});
  while (!s.empty()) {
    ind = s.top().first;
    int d = s.top().second;
    s.pop();
    if (d == -1) {
      en[ind] = ti;
      continue;
    }
    s.push({ind, -1});
    dep[ind] = d;
    st[ind] = ++ti;
    for (auto u : tree[ind]) {
      s.push({u, d + 1});
    }
  }
}
void lz(int n, int l, int r) {
  if (l == r) return;
  if (seg[n].second) {
    seg[2 * n + 1].first += seg[n].second;
    seg[2 * n + 2].first += seg[n].second;
    seg[2 * n + 1].second += seg[n].second;
    seg[2 * n + 2].second += seg[n].second;
  }
  seg[n].second = 0;
}
void upd(int n, int a, int b, int val, int l = 0, int r = ti) {
  lz(n, l, r);
  if (l == a && r == b) {
    seg[n].first += val;
    seg[n].second += val;
    return;
  }
  int md = (l + r) >> 1;
  if (a <= md) upd(2 * n + 1, a, min(b, md), val, l, md);
  if (b > md) upd(2 * n + 2, max(a, md + 1), b, val, md + 1, r);
  seg[n].first = seg[2 * n + 2].first + seg[2 * n + 1].first;
}
int qry(int n, int a, int b, int l = 0, int r = ti) {
  lz(n, l, r);
  if (l == a && b == r) {
    return seg[n].first;
  }
  int md = (l + r) >> 1;
  bool res = false;
  if (a <= md) res += qry(2 * n + 1, a, min(b, md), l, md);
  if (b > md) res += qry(2 * n + 2, max(a, md + 1), b, md + 1, r);
  return res;
}
bool solve(int ind) {
  queue<int> bfs;
  bfs.push(ind);
  while (!bfs.empty()) {
    ind = bfs.front();
    bfs.pop();
    if (!want[ind].empty()) {
      if (qry(0, st[ind], en[ind]) != 0) {
        return false;
      }
      for (auto u : want[ind]) {
        cur.insert(u);
        upd(0, st[u], en[u], 1);
      }
    }
    if (cur.find(ind) != cur.end()) {
      upd(0, st[ind], en[ind], -1);
      cur.erase(ind);
    }
    for (auto u : tree[ind]) {
      bfs.push(u);
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, M, u, v;
  cin >> N >> M;
  tree.resize(N);
  want.resize(N);
  for (int i = 0; i < M; i++) {
    cin >> u >> v;
    u--, v--;
    tree[u].push_back(v);
    nroot[v] = true;
  }
  for (int i = 0; i < N; i++) {
    if (!nroot[i]) dfs(i);
  }
  for (int i = 0; i < N; i++) {
    cin >> u;
    u--;
    want[u].push_back(i);
    sol.insert({-dep[u], u});
  }
  can = true;
  for (int i = 0; i < N; i++) {
    if (!nroot[i]) can &= solve(i);
  }
  if (!can) {
    cout << "-1\n";
    return 0;
  }
  cout << sol.size() << '\n';
  for (auto p : sol) cout << p.second + 1 << '\n';
  return 0;
}
