#include <bits/stdc++.h>
using namespace std;
int n, m, a, b, vis[100000 + 2] = {}, par[100000 + 2] = {};
vector<int> gr[100000 + 2];
int gift[100000 + 5];
vector<pair<int, int>> List;
vector<int> fin;
stack<int> S;
void rd_graph_un() {
  int i;
  cin >> n >> m;
  for (i = 1; i <= m; i++) {
    cin >> a >> b;
    gr[a].push_back(b);
    par[b] = a;
  }
  for (i = 1; i <= n; i++) {
    cin >> gift[i];
  }
}
void dfs(int v) {
  int i;
  vis[v] = 1;
  for (i = 0; i < gr[v].size(); i++) {
    if (!vis[gr[v][i]]) {
      dfs(gr[v][i]);
    }
  }
  List.push_back({v, gift[v]});
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int i, j, fl = 0;
  vector<int> start;
  rd_graph_un();
  for (i = 1; i <= n; i++) {
    if (par[i] == 0) start.push_back(i);
  }
  for (i = 0; i < start.size(); i++) {
    dfs(start[i]);
  }
  for (i = 0; i < List.size(); i++) {
    if (List[i].second == List[i].first)
      fin.push_back(List[i].first);
    else if (List[i].second != gift[par[List[i].first]]) {
      fl = 1;
      break;
    }
  }
  if (fl == 1)
    cout << -1 << '\n';
  else {
    cout << fin.size() << '\n';
    for (i = 0; i < fin.size(); i++) cout << fin[i] << '\n';
  }
  return 0;
}
