#include <bits/stdc++.h>
using namespace std;
vector<int> A[100100];
bool B[100100];
int P[100100], N, M, RS[100100], rs;
void dfs1(int x) {
  B[x] = 1;
  for (auto it : A[x])
    if (!B[it]) dfs1(it);
}
int dfs2(int x) {
  for (auto it : A[x]) {
    int rs = dfs2(it);
    if (rs == -1 || (rs != 0 && rs != P[x])) return -1;
  }
  if (P[x] == x) {
    RS[rs++] = x;
    return 0;
  }
  return P[x];
}
int main() {
  cin >> N >> M;
  for (int x, y; M--;) {
    cin >> x >> y;
    A[x].push_back(y);
  }
  for (int i = 1; i <= N; i++) cin >> P[i];
  for (int i = 1; i <= N; i++)
    if (!B[i]) {
      dfs1(i);
      B[i] = 0;
    }
  for (int i = 1; i <= N; i++)
    if (!B[i] && dfs2(i) == -1) return cout << -1, 0;
  cout << rs << '\n';
  for (int i = 0; i < rs; i++) cout << RS[i] << '\n';
}
