#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 9;
int n, m, par[MAX], a[MAX];
vector<int> v, g[MAX];
void dfs(int k) {
  for (auto u : g[k]) {
    dfs(u);
    if (a[u] != -1 && a[u] != a[k]) cout << -1, exit(0);
  }
  if (a[k] == k) v.push_back(k), a[k] = -1;
}
int main() {
  cin >> n >> m, memset(par, -1, sizeof par);
  for (int i = 0, v, u; i < m; i++)
    cin >> v >> u, g[--v].push_back(--u), par[u] = v;
  for (int i = 0; i < n; i++) cin >> a[i], a[i]--;
  for (int i = 0; i < n; i++)
    if (par[i] == -1) dfs(i);
  cout << v.size() << '\n';
  for (auto i : v) cout << i + 1 << '\n';
}
