#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e16 + 9;
const double PI = 3.14159265;
const long long M = 100005;
const long long MAX = 25;
long long r[M], vis[M], c[M], u[M];
vector<long long> adj[M], k, ans;
void dfs(long long x) {
  vis[x] = 1;
  for (auto i : adj[x]) {
    if (!vis[i]) dfs(i);
  }
  k.push_back(x);
}
void dfs2(long long x, long long pa) {
  if (r[x]) return;
  r[x] = pa;
  for (auto i : adj[x]) {
    dfs2(i, pa);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) {
    long long a, b;
    cin >> a >> b;
    adj[a].push_back(b);
  }
  for (long long i = 1; i <= n; i++) cin >> c[i], u[c[i]] = 1;
  for (long long i = 1; i <= n; i++)
    if (!vis[i]) dfs(i);
  for (long long i = 0; i < k.size(); i++)
    if (u[k[i]]) dfs2(k[i], k[i]), ans.push_back(k[i]);
  for (long long i = 1; i <= n; i++) {
    if (r[i] != c[i]) {
      cout << "-1\n";
      return 0;
    }
  }
  cout << ans.size() << "\n";
  for (long long i = 1; i <= ans.size(); i++) cout << ans[i - 1] << "\n";
}
