#include <bits/stdc++.h>
using namespace std;
const int LIM = 1e+5 + 10;
vector<vector<int>> g(LIM);
vector<bool> in(LIM, 0);
vector<int> target(LIM);
vector<int> ans;
bool ok = true;
void dfs(int u) {
  for (int to : g[u]) {
    if (target[u] == target[to]) {
      dfs(to);
    } else {
      if (target[to] != to)
        ok = false;
      else
        dfs(to);
    }
  }
  if (target[u] == u) ans.push_back(u);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    --u;
    --v;
    g[u].push_back(v);
    in[v] = true;
  }
  for (int i = 0; i < n; ++i) {
    cin >> target[i];
    --target[i];
  }
  for (int i = 0; i < n; ++i) {
    if (!in[i]) dfs(i);
    if (!ok) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans.size() << endl;
  for (int i : ans) cout << i + 1 << '\n';
  return 0;
}
