#include<bits/stdc++.h>
#define rint register int
#define deb(x) cerr<<#x<<" = "<<(x)<<'\n';
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
const int maxn = 1e6 + 5;
int n, m, rt, a[maxn][2];
int f[maxn], fa[maxn];
int to[maxn], deg[maxn], pos[maxn];
vector <int> g[maxn], ans, res;

int getf(int x) {
	return x == f[x] ? x : f[x] = getf(f[x]);
}

signed main() {
	scanf("%d%d", &n, &m);
	for(int i=1, x; i<=n; i++) {
		scanf("%d", &x);
		fa[i] = x, f[i] = i;
		if(x == 0) rt = i;
	}
	for(int i=1, u, v; i<=m; i++) {
		scanf("%d%d", &u, &v);
		a[i][0] = u, a[i][1] = v;
		int fu = getf(u), fv = getf(v);
		f[fv] = fu, to[u] = v;
	}
	for(int i=1; i<=n; i++) {
		int u = fa[i], v = i;
		if(u == 0) continue;
		int fu = getf(u), fv = getf(v);
		if(fu == fv) continue;
		g[fu].push_back(fv), deg[fv]++;
	}
	queue <int> q; q.push(rt);
	while(q.size()) {
		int u = q.front(); q.pop();
		ans.push_back(u);
		for(auto v : g[u]) 
			if(--deg[v] == 0)
				q.push(v);
	}
	for(auto i : ans) 
		for(int j=i; j; j=to[j]) {
			res.push_back(j); //deb(j)
			if(res.size() > n) return puts("0"), 0;
		}
	if(res.size() ^ n) return puts("0"), 0;
	for(int i=0; i<n; i++) pos[res[i]] = i;
	for(int i=1; i<=n; i++) {
		int u = fa[i], v = i;
//		printf("%d %d %d %d\n", u, v, pos[u], pos[v]);
		if(pos[u] > pos[v]) return puts("0"), 0;
	}
	for(auto i : res) printf("%d ", i);
}
/*

*/
