#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
typedef long long ll;
const ll MAX = 1e6 + 100;
ll n, m, g[MAX], a[MAX];
vector<ll> adj[MAX], ans;
bool go[MAX];
void dfs(ll u) {
  ll mini = 1e9;
  for (ll v : adj[u]) {
    dfs(v);
    if (a[u] != a[v] && !go[v]) {
      cout << "-1\n";
      exit(0);
    }
  }
  if (a[u] == u) ans.push_back(a[u]), go[u] = 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll u, v;
  cin >> n >> m;
  for (ll i = 0; i < (ll)m; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    g[v]++;
  }
  for (ll i = 1; i < (ll)n + 1; i++) cin >> a[i];
  for (ll i = 1; i < (ll)n + 1; i++)
    if (g[i] == 0) dfs(i);
  cout << ans.size() << endl;
  for (ll it : ans) cout << it << " ";
  cout << endl;
}
