#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> adj[100002];
int a[100002];
int topo[100002];
int dp[100002];
bool getGift[100002];
bool vis[100002];
int nxt;
void dfs(int v) {
  vis[v] = true;
  for (int x : adj[v]) {
    if (!vis[x]) {
      dfs(x);
    }
  }
  topo[nxt++] = v;
}
bool solve() {
  for (int i = n - 1; i >= 0; --i) {
    int v = topo[i];
    dp[v] = -1;
    if (((int)(adj[v].size())) > 0) {
      int u = adj[v][0];
      dp[v] = dp[u];
    }
    if (getGift[v]) dp[v] = v;
    if (dp[v] != a[v]) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0);
  while (cin >> n >> m) {
    for (int i = 0; i < m; ++i) {
      int p, q;
      cin >> p >> q;
      adj[q].push_back(p);
    }
    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
    }
    memset(getGift, false, sizeof(getGift));
    int qtd = 0;
    for (int i = 1; i <= n; ++i) {
      if (!getGift[a[i]]) {
        getGift[a[i]] = true;
        ++qtd;
      }
    }
    memset(vis, false, sizeof(vis));
    nxt = 0;
    for (int i = 1; i <= n; ++i) {
      if (!vis[i]) {
        dfs(i);
      }
    }
    reverse(topo, topo + n);
    if (!solve()) {
      cout << "-1\n";
    } else {
      cout << qtd << "\n";
      for (int i = 0; i < n; ++i) {
        if (getGift[topo[i]]) {
          cout << topo[i] << "\n";
        }
      }
    }
  }
  return 0;
}
