#include <bits/stdc++.h>
using namespace std;
struct node {
  int begin, end, next;
} edge[100010];
int cnt, Head[100010], id[100010], a[100010];
bool vis[100010];
void addedge(int bb, int ee) {
  edge[++cnt].begin = bb;
  edge[cnt].end = ee;
  edge[cnt].next = Head[bb];
  Head[bb] = cnt;
}
void dfs1(int u) {
  int i, v;
  for (i = Head[u]; i != -1; i = edge[i].next) {
    v = edge[i].end;
    if (a[u] != a[v] && a[v] != v) {
      printf("-1");
      exit(0);
    }
    dfs1(v);
  }
}
void dfs2(int u) {
  int i, v;
  for (i = Head[u]; i != -1; i = edge[i].next) {
    v = edge[i].end;
    dfs2(v);
  }
  if (vis[u] == true) printf("%d\n", u);
}
int main() {
  int n, m, i, u, v, gs;
  scanf("%d %d", &n, &m);
  memset(Head, -1, sizeof(Head));
  cnt = 1;
  for (i = 1; i <= m; i++) {
    scanf("%d %d", &u, &v);
    addedge(u, v);
    id[v]++;
  }
  gs = 0;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    vis[a[i]] = true;
  }
  for (i = 1; i <= n; i++)
    if (vis[i] == true) gs++;
  for (i = 1; i <= n; i++)
    if (id[i] == 0) dfs1(i);
  printf("%d\n", gs);
  for (i = 1; i <= n; i++)
    if (id[i] == 0) dfs2(i);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
