#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> grafo[100100];
bool root[100100] = {false};
bool ferrou = false;
int wish[100100];
int cont = 0;
bool flag[100100] = {false};
int val = 0;
void DFP(int x) {
  for (vector<int>::iterator it = grafo[x].begin(), fim = grafo[x].end();
       it != fim; it++) {
    DFP(*it);
  }
  if (flag[x]) printf("%d\n", x);
}
void DFS(int x, int last) {
  if (wish[x] == last) {
  } else if (wish[x] == x) {
    last = wish[x];
    if (!flag[wish[x]]) {
      val++;
      flag[wish[x]] = true;
    }
  } else {
    ferrou = true;
  }
  for (vector<int>::iterator it = grafo[x].begin(), fim = grafo[x].end();
       it != fim; it++) {
    DFS(*it, last);
  }
}
int main() {
  scanf("%d %d", &n, &m);
  int x, y;
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &x, &y);
    grafo[x].push_back(y);
    root[y] = true;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &wish[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (!root[i]) {
      DFS(i, -1);
    }
  }
  if (ferrou) {
    cout << "-1" << endl;
    return 0;
  }
  cout << val << endl;
  for (int i = 1; i <= n; i++) {
    if (!root[i]) {
      DFP(i);
    }
  }
}
