#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 2e18;
const int N = 121234;
int n, m;
vector<int> G[N];
int val[N];
int d[N];
int fa[N];
int ans[N];
int tot;
int dfs(int u) {
  if (G[u].size() == 0) fa[u] = val[u];
  for (int i = 0; i < G[u].size(); ++i) {
    int v = G[u][i];
    if (!dfs(v)) return 0;
    if (fa[v] != -1 && fa[v] != val[u]) return 0;
    fa[u] = val[u];
  }
  if (fa[u] == u) {
    ans[tot++] = u;
    fa[u] = -1;
  }
  return 1;
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    int i, j;
    tot = 0;
    memset(fa, -1, sizeof(fa));
    for (i = 0; i < m; ++i) {
      int u, v;
      scanf("%d%d", &u, &v);
      G[u].push_back(v);
      d[v]++;
    }
    for (i = 1; i <= n; ++i) scanf("%d", &val[i]);
    int ok = 1;
    for (i = 1; i <= n; ++i) {
      if (d[i] == 0) {
        if (!dfs(i)) {
          ok = 0;
          break;
        }
      }
    }
    if (!ok)
      puts("-1");
    else {
      printf("%d\n", tot);
      for (i = 0; i < tot; ++i) printf("%d\n", ans[i]);
    }
  }
}
