#include <bits/stdc++.h>
using namespace std;
bool st, cale[100010];
int a[100010], p[100010], q[100010], n, m, otac[100010];
vector<int> gift, glavni;
vector<int> adj[100010];
void dfs(int x) {
  if (st) {
    if (!cale[x]) {
      gift.push_back(x);
    } else {
      if (a[x] == x) {
        gift.push_back(x);
      } else {
        if (a[x] != a[otac[x]]) {
          st = false;
          return;
        }
      }
    }
    for (int i = 0; i < adj[x].size(); i++) {
      dfs(adj[x][i]);
    }
  }
  return;
}
int main() {
  st = true;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < 100010; i++) {
    cale[i] = false;
  }
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &p[i], &q[i]);
    cale[q[i]] = true;
    otac[q[i]] = p[i];
    adj[p[i]].push_back(q[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (!cale[i]) {
      glavni.push_back(i);
    }
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < glavni.size(); i++) {
    dfs(glavni[i]);
  }
  if (st) {
    printf("%d\n", gift.size());
    for (int i = gift.size() - 1; i >= 0; i--) {
      printf("%d\n", gift[i]);
    }
  } else {
    printf("-1");
  }
  return 0;
}
