#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[100005];
vector<int> G[100005];
int beg[100005], fin[100005], dfstime, res;
int color[100005];
bool visited[100005];
bool dfsed[100005];
int p[100005];
vector<int> mjk;
void dfs(int u) {
  beg[u] = ++dfstime;
  for (int i = 0; i < G[u].size(); i++) dfs(G[u][i]);
  mjk.push_back(u);
  fin[u] = dfstime;
}
void dfs_(int u) {
  if (visited[u]) {
    cout << -1;
    exit(0);
  }
  visited[u] = 1;
  for (int i = 0; i < G[u].size(); i++) dfs_(G[u][i]);
}
bool cmp(int x, int y) {
  if (beg[x] <= beg[y] && fin[y] <= fin[x]) return x > y;
  return x <= y;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    G[x].push_back(y);
    p[y] = x;
  }
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++)
    if (!p[i]) dfs(i);
  for (int i = 1; i <= n; i++) {
    int pos = i;
    while (1) {
      if (!color[pos]) {
        color[pos] = a[i];
        pos = p[pos];
        if (pos == 0 || pos == p[a[i]]) break;
      } else {
        if (a[i] != color[pos]) {
          cout << "-1";
          exit(0);
        } else
          break;
      }
    }
    if (!dfsed[a[i]]) res++, dfsed[a[i]] = 1;
  }
  printf("%d\n", res);
  for (int i = 0; i < n; i++)
    if (dfsed[mjk[i]]) printf("%d\n", mjk[i]);
}
