#include <bits/stdc++.h>
using namespace std;
const int max_n = 100005;
struct edge {
  int to;
  int next;
} es[max_n];
int cnt = 0;
int head[max_n];
int n, m;
int gift[max_n];
int ans[max_n];
int in_degree[max_n];
int top;
int fa;
bool flag;
void add(int u, int v) {
  es[cnt].to = v;
  es[cnt].next = head[u];
  head[u] = cnt++;
}
void dfs(int u) {
  for (int i = head[u]; i != -1; i = es[i].next) {
    int v = es[i].to;
    dfs(v);
    if (gift[v] != gift[u] && gift[v] != v) flag = false;
  }
  if (gift[u] == u) ans[top++] = u;
}
int main() {
  int p, q;
  top = 0;
  flag = true;
  memset(in_degree, 0, sizeof(in_degree));
  for (int i = 0; i < max_n; i++) head[i] = -1;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &p, &q);
    add(p, q);
    in_degree[q]++;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p);
    gift[i] = p;
  }
  for (int i = 1; i <= n && flag; i++) {
    if (in_degree[i] == 0) dfs(i);
  }
  if (flag) {
    printf("%d\n", top);
    for (int i = 0; i < top; i++) printf("%d\n", ans[i]);
  } else
    printf("-1\n");
  return 0;
}
