#include <bits/stdc++.h>
static void depth(const std::vector<std::vector<long> > &g, long s,
                  std::vector<long> &d) {
  std::stack<long> st;
  st.push(s);
  d[s] = 0;
  while (!st.empty()) {
    const long u = st.top();
    st.pop();
    for (long i = 0; i != (long)g[u].size(); ++i) {
      const long v = g[u][i];
      st.push(v);
      d[v] = d[u] + 1;
    }
  }
}
static bool order(const std::vector<std::vector<long> > &g,
                  const std::vector<long> &a, const std::vector<long> &d,
                  const std::vector<char> &u, long s, long p,
                  std::vector<long> &o) {
  if (p >= 0 && a[s] != a[p] && d[a[s]] <= d[p]) return false;
  for (long i = 0; i != (long)g[s].size(); ++i) {
    const long t = g[s][i];
    if (!order(g, a, d, u, t, s, o)) return false;
  }
  if (u[s]) o.push_back(s);
  return true;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  long n, m;
  std::cin >> n >> m;
  std::vector<long> p(n, -1l);
  std::vector<std::vector<long> > g(n);
  for (long i = 0; i != m; ++i) {
    long parent, child;
    std::cin >> parent >> child;
    p[child - 1] = parent - 1;
    g[parent - 1].push_back(child - 1);
  }
  std::vector<long> a(n);
  std::vector<char> u(n);
  for (long i = 0; i != n; ++i) {
    std::cin >> a[i];
    u[--a[i]] = 1;
  }
  std::vector<long> d(n);
  std::vector<long> o;
  for (long i = 0; i != n; ++i) {
    if (p[i] >= 0) continue;
    depth(g, i, d);
    if (!order(g, a, d, u, i, -1, o)) {
      std::cout << "-1\n";
      return 0;
    }
  }
  std::cout << o.size() << "\n";
  for (long i = 0; i != (long)o.size(); ++i) std::cout << o[i] + 1 << "\n";
  return 0;
}
