#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
int n, k, w, Cnt, A, x, y, sum, num, q[N], u[N], v[N], pre[N], pos[N], nxt[N], p[N], Ind[N], col[N], ind[N];
vector <int> vec[N], G[N]; queue <int> Q;
int main() {
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; ++ i) scanf("%d", pre + i);
	for (int i = 1; i <= k; ++ i) scanf("%d%d", &x, &y), nxt[x] = y, ++ Ind[y], u[++ Cnt] = x, v[Cnt] = y;
	for (int i = 1; i <= n; ++ i) if (!Ind[i]) {
		++ num, x = i;
		while (x) vec[num].push_back(x), col[x] = num, x = nxt[x];
	}
	for (int i = 1; i <= n; ++ i) if (col[pre[i]] != col[i]) G[col[pre[i]]].push_back(col[i]);
	for (int i = 1; i <= num; ++ i) sort(G[i].begin(), G[i].end()), unique(G[i].begin(), G[i].end());
	for (int i = 1; i <= num; ++ i) for (int j = 0; j < G[i].size(); ++ j) ++ ind[G[i][j]];
	for (int i = 1; i <= num; ++ i) if (!ind[i]) Q.push(i), p[++ w] = i;
	while (!Q.empty()) {
		x = Q.front(); Q.pop();
		for (int i = 0; i < G[x].size(); ++ i) {
			-- ind[y = G[x][i]];
			if (!ind[y]) Q.push(y), p[++ w] = y;
		}
	}
	for (int i = 1; i <= num; ++ i) sum += (int) vec[i].size();
	if (w < num || sum < n) return puts("0"), 0;
	for (int i = 1; i <= num; ++ i) for (int j = 0; j < vec[p[i]].size(); ++ j) q[++ A] = vec[p[i]][j];
	for (int i = 1; i <= n; ++ i) pos[q[i]] = i;
	for (int i = 1; i <= n; ++ i) if (pos[pre[i]] >= pos[i]) return puts("0"), 0;
	for (int i = 1; i <= k; ++ i) if (pos[u[i]] + 1 != pos[v[i]]) return puts("0"), 0;
	for (int i = 1; i <= n; ++ i) printf("%d ", q[i]);
	return 0;
}