#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
int n, m, deg[N], a[N], ans;
bool visited[N], request[N];
vector<int> E[N], par, res;
void DFS(int u, int last) {
  visited[u] = true;
  if (request[u]) res.push_back(u);
  for (int i = 0; i < E[u].size(); i++) {
    int v = E[u][i];
    if (visited[v]) break;
    if (a[v] != last && a[v] != v) {
      ans = -1;
      break;
    }
    if (request[v])
      DFS(v, v);
    else
      DFS(v, last);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    deg[v]++;
    E[u].push_back(v);
  }
  memset(visited, false, sizeof(visited));
  ;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    request[a[i]] = true;
    if (deg[i] == 0) par.push_back(i);
  }
  for (int i = 0; i < par.size(); i++) {
    int u = par[i];
    DFS(u, u);
    if (ans == -1) break;
  }
  if (ans == -1)
    cout << ans;
  else {
    cout << res.size() << endl;
    for (int i = res.size() - 1; i >= 0; i--) cout << res[i] << endl;
  }
  return 0;
}
