#include <bits/stdc++.h>
using namespace std;
const int N = 100111;
vector<int> g[N], ans;
int p[N], h[N], par[N];
bool used[N], vis[N];
pair<int, int> l[N];
int root(int v) { return par[v] < 0 ? v : par[v] = root(par[v]); }
void check(int v, int an) {
  for (int i = 0; i < g[v].size(); i++)
    if (h[p[g[v][i]]] < h[v] && p[g[v][i]] != an) {
      cout << -1 << endl;
      exit(0);
    }
}
void dfs(int v, int dep) {
  vis[v] = true;
  h[v] = dep;
  l[v] = make_pair(-h[p[v]], v);
  for (int i = 0; i < g[v].size(); i++) dfs(g[v][i], dep + 1);
}
int main() {
  fill(par, par + N, -1);
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[--u].push_back(--v);
    par[v] = u;
  }
  for (int i = 0; i < n; i++) cin >> p[i], p[i]--;
  for (int i = 0; i < n; i++)
    if (!vis[i]) dfs(root(i), 0);
  sort(l, l + n);
  for (int i = 0; i < n; i++) {
    check(l[i].second, p[l[i].second]);
    if (!used[p[l[i].second]]) ans.push_back(p[l[i].second]);
    used[p[l[i].second]] = true;
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) cout << ans[i] + 1 << ' ';
  cout << endl;
}
