#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
double fixAngle(double A) { return A > 1 ? 1 : (A < -1 ? -1 : A); }
double dcmp(double a, double b) {
  return fabs(a - b) < 1e-6 ? 0 : a > b ? 1 : -1;
}
int dfstime[100000 + 5];
int target[100000 + 5];
int visited[100000 + 5];
vector<int> graph[100000 + 5];
int dfsnum = 1;
int resultofcheck[100000 + 5];
vector<int> ans;
int check(int idx) {
  visited[idx] = 1;
  dfstime[idx] = dfsnum++;
  vector<int> x;
  for (int child : graph[idx]) {
    int a = check(child);
    resultofcheck[child] = a;
    if (a == -1) return -1;
    if (dfstime[a] <= dfstime[idx] && a != target[idx]) {
      return -1;
    }
  }
  return target[idx];
}
void solve(int idx) {
  for (int child : graph[idx]) {
    if (target[child] != target[idx]) {
      solve(child);
    }
  }
  for (int child : graph[idx]) {
    if (target[child] == target[idx]) {
      solve(child);
    }
  }
  if (idx == target[idx]) ans.push_back(target[idx]);
}
int indegree[100000 + 5];
int printed[100000 + 5];
int main() {
  int n, m;
  cin >> n >> m;
  int a, b;
  for (long long i = 0; i < m; i++) {
    cin >> a >> b;
    graph[a].push_back(b);
    indegree[b]++;
  }
  for (long long i = 0; i < n; i++) {
    cin >> target[i + 1];
  }
  for (int i = 1; i <= n; i++) {
    if (indegree[i] == 0) {
      if (check(i) == -1) {
        cout << -1 << endl;
        return 0;
      }
      solve(i);
    }
  }
  vector<int> p;
  for (int x : ans) {
    if (printed[x] == 0) p.push_back(x);
    printed[x]++;
  }
  cout << p.size() << endl;
  for (int x : p) {
    cout << x << endl;
  }
}
