#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return (a ? gcd(b % a, a) : b); }
void exgcd(long long a, long long b, long long& d, long long& x, long long& y) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
  } else {
    exgcd(b, a % b, d, y, x);
    y -= x * (a / b);
  }
}
long long power(long long a, long long n) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
    }
    n >>= 1;
    a *= a;
  }
  return p;
}
long long powermod(long long a, long long n, long long mod) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
      p %= mod;
    }
    n >>= 1;
    a *= a;
    a %= mod;
  }
  return p % mod;
}
const int inf = 0x3f3f3f3f, mod = 1e9 + 7;
const int maxn = 1e5 + 100;
const double PI = acos(-1.0);
int n, m, k;
int like[maxn], flag[maxn], gg[maxn], du[maxn];
vector<int> nex[maxn], anx, ha[maxn];
set<int> ff;
set<int>::iterator it;
bool dfs(int x, int& ss) {
  flag[x] = 1;
  int sum = -1;
  for (int i = 0; i < nex[x].size(); i++) {
    int sg;
    if (!dfs(nex[x][i], sg)) return false;
    if (sg == -1) continue;
    if (sum == -1)
      sum = sg;
    else if (sum != sg)
      return false;
  }
  if (sum == -1)
    sum = like[x];
  else if (sum != like[x])
    return false;
  if (sum == x)
    ss = -1;
  else
    ss = sum;
  if (gg[x] == 1) anx.push_back(x);
  return true;
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    memset(gg, 0, sizeof(gg));
    memset(flag, 0, sizeof(flag));
    memset(du, 0, sizeof(du));
    for (int i = 1; i <= n; i++) ha[i].clear(), nex[i].clear();
    for (int i = 1; i <= m; i++) {
      int u, v;
      scanf("%d%d", &u, &v);
      nex[u].push_back(v);
      du[v]++;
    }
    for (int i = 1; i <= n; i++) {
      scanf("%d", &like[i]);
      ha[like[i]].push_back(i);
      gg[like[i]] = 1;
    }
    anx.clear();
    int flv = 1, sk;
    for (int i = 1; i <= n; i++)
      if (du[i] == 0)
        if (!dfs(i, sk)) {
          flv = 0;
          break;
        }
    if (flv == 1) {
      cout << anx.size() << endl;
      for (int i = 0; i < anx.size(); i++) cout << anx[i] << endl;
    } else
      cout << -1 << endl;
  }
  return 0;
}
