#include <bits/stdc++.h>
using namespace std;
template <class X, class Y>
void minimize(X &x, const Y &y) {
  if (x > y) x = y;
}
template <class X, class Y>
void maximize(X &x, const Y &y) {
  if (x < y) x = y;
}
template <class T>
T Abs(const T &x) {
  return (x < 0 ? -x : x);
}
int par[100100], req[100100], high[100100], n;
vector<int> child[100100];
void loadTree(void) {
  int m;
  scanf("%d%d", &n, &m);
  for (int love = 0, _n = (m); love < _n; love = love + 1) {
    int u, v;
    scanf("%d%d", &u, &v);
    par[v] = u;
    child[u].push_back(v);
  }
  for (int i = (1), _b = (n); i <= _b; i = i + 1) scanf("%d", &req[i]);
}
void dfs(int u) {
  for (__typeof((child[u]).begin()) it = (child[u]).begin();
       it != (child[u]).end(); it++) {
    int v = *it;
    high[v] = high[u] + 1;
    if (req[v] != req[u] && req[v] != v) {
      printf("-1\n");
      exit(0);
    }
    dfs(*it);
  }
}
bool CompHigh(const int &x, const int &y) { return (high[x] > high[y]); }
void process(void) {
  for (int i = (1), _b = (n); i <= _b; i = i + 1)
    if (par[i] == 0) dfs(i);
  vector<int> node;
  for (int i = (1), _b = (n); i <= _b; i = i + 1) node.push_back(req[i]);
  sort((node).begin(), (node).end());
  node.resize(unique((node).begin(), (node).end()) - node.begin());
  sort((node).begin(), (node).end(), CompHigh);
  printf("%d\n", (int)node.size());
  for (__typeof((node).begin()) it = (node).begin(); it != (node).end(); it++)
    printf("%d\n", *it);
}
int main(void) {
  loadTree();
  process();
  return 0;
}
