#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> G[100009];
int num[100009];
int k, b[100009];
int a[100009];
bool dfs(int x, int q) {
  for (int i = 0; i < G[x].size(); ++i) {
    int &e = G[x][i];
    if (a[e] != e && a[e] != q) return 1;
    if (a[e] == e) b[k++] = e;
    if (dfs(e, a[e])) return 1;
  }
  return 0;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    num[v]++;
  }
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= n; ++i) {
    if (num[i] == 0) {
      b[k++] = a[i];
      if (dfs(i, a[i])) return puts("-1") * 0;
    }
  }
  printf("%d\n", k);
  for (int i = k - 1; i >= 0; --i) {
    printf("%d\n", b[i]);
  }
  return 0;
}
