#include <iostream>
#include <vector>
#include <memory.h>
using namespace std;
const int MAX_N = (int) 1e5;
vector<int> g[MAX_N];
int a[MAX_N];
bool inA[MAX_N];
vector<int> ts;
bool used[MAX_N];
void dfs1(int v) {
if (used[v]) {
return;
}
used[v] = true;
for (int i = 0; i < g[v].size(); i++) {
dfs1(g[v][i]);
}
ts.push_back(v);
}
int r[MAX_N];
void dfs2(int v, int x) {
if (r[v] != -1) {
return;
}
r[v] = x;
for (int i = 0; i < g[v].size(); i++) {
dfs2(g[v][i], x);
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
for (int i = 0; i < m; i++) {
int x, y;
cin >> x >> y;
--x;
--y;
g[x].push_back(y);
}
for (int i = 0; i < n; i++) {
cin >> a[i];
--a[i];
inA[a[i]] = true;
}
for (int i = 0; i < n; i++) {
if (!used[i]) {
dfs1(i);
}
}
memset(r, -1, sizeof(r));
vector<int> ans;
for (int i = 0; i < n; i++) {
if (inA[ts[i]]) {
dfs2(ts[i], ts[i]);
ans.push_back(ts[i]);
}
}
for (int i = 0; i < n; i++) {
if (r[i] != a[i]) {
cout << -1;
return 0;
}
}
cout << ans.size() << "\n";
for (int i = 0; i < ans.size(); i++) {
cout << ans[i] + 1 << "\n";
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8bWVtb3J5Lmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1BWF9OID0gKGludCkgMWU1OwoKdmVjdG9yPGludD4gZ1tNQVhfTl07CmludCBhW01BWF9OXTsKYm9vbCBpbkFbTUFYX05dOwoKdmVjdG9yPGludD4gdHM7CmJvb2wgdXNlZFtNQVhfTl07Cgp2b2lkIGRmczEoaW50IHYpIHsKICAgIGlmICh1c2VkW3ZdKSB7CiAgICAgICAgcmV0dXJuOwogICAgfQogICAgdXNlZFt2XSA9IHRydWU7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IGdbdl0uc2l6ZSgpOyBpKyspIHsKICAgICAgICBkZnMxKGdbdl1baV0pOwogICAgfQogICAgdHMucHVzaF9iYWNrKHYpOwp9CgppbnQgcltNQVhfTl07CnZvaWQgZGZzMihpbnQgdiwgaW50IHgpIHsKICAgIGlmIChyW3ZdICE9IC0xKSB7CiAgICAgICAgcmV0dXJuOwogICAgfQogICAgclt2XSA9IHg7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IGdbdl0uc2l6ZSgpOyBpKyspIHsKICAgICAgICBkZnMyKGdbdl1baV0sIHgpOwogICAgfQp9CgppbnQgbWFpbigpIHsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgY2luLnRpZSgwKTsKICAgIGludCBuLCBtOwogICAgY2luID4+IG4gPj4gbTsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbTsgaSsrKSB7CiAgICAgICAgaW50IHgsIHk7CiAgICAgICAgY2luID4+IHggPj4geTsKICAgICAgICAtLXg7CiAgICAgICAgLS15OwogICAgICAgIGdbeF0ucHVzaF9iYWNrKHkpOwogICAgfQoKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CiAgICAgICAgY2luID4+IGFbaV07CiAgICAgICAgLS1hW2ldOwogICAgICAgIGluQVthW2ldXSA9IHRydWU7CiAgICB9CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICBpZiAoIXVzZWRbaV0pIHsKICAgICAgICAgICAgZGZzMShpKTsKICAgICAgICB9CiAgICB9CgogICAgbWVtc2V0KHIsIC0xLCBzaXplb2YocikpOwogICAgdmVjdG9yPGludD4gYW5zOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICBpZiAoaW5BW3RzW2ldXSkgewogICAgICAgICAgICBkZnMyKHRzW2ldLCB0c1tpXSk7CiAgICAgICAgICAgIGFucy5wdXNoX2JhY2sodHNbaV0pOwogICAgICAgIH0KICAgIH0KCiAgICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgICAgIGlmIChyW2ldICE9IGFbaV0pIHsKICAgICAgICAgICAgY291dCA8PCAtMTsKICAgICAgICAgICAgcmV0dXJuIDA7CiAgICAgICAgfQogICAgfQoKCiAgICBjb3V0IDw8IGFucy5zaXplKCkgPDwgIlxuIjsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgYW5zLnNpemUoKTsgaSsrKSB7CiAgICAgICAgY291dCA8PCBhbnNbaV0gKyAxIDw8ICJcbiI7CiAgICB9CgoKICAgIHJldHVybiAwOwp9