#include <cstdio>
#include <vector>
#include <queue>

using namespace std;

const int N = 3e5 + 5;

int p[N];

int father[N], son[N];

int find(int x) {
	if (x == father[x]) {
		return x;
	}
	return father[x] = find(father[x]);
}

int find(int x, int y) {
	while (x) {
		if (x == y) {
			return 1;
		}
		x = son[x];
	}
	return 0;
}

int in[N];

vector<int> edge[N];

void add(int x, int y) {
	edge[x].push_back(y);
}

int ans[N], tot;

bool vis[N];

int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &p[i]);
	}
	for (int i = 1; i <= n; ++i) {
		father[i] = i;
	}
	for (int i = 1; i <= m; ++i) {
		int x, y;
		scanf("%d%d", &x, &y);
		if (son[x] || father[y] != y || find(x) == find(y)) {
			printf("0");
			return 0;
		}
		son[x] = y;
		father[y] = x;
	}
//	for (int i = 1; i <= n; ++i) {
//		if (!father[i]) {
//			father[i] = i;
//		}
////		printf("%d %d\n", father[i], son[i]);
//	}
	for (int i = 1; i <= n; ++i) {
//		printf("%d\n", i);
		int u = find(p[i]), v = find(i);
		if (u != v) {
			++in[v];
			add(u, v);
		}
//		printf("i %d %d\n", u, v);
//		if (u == v) {
//			if (find(i, p[i])) {
//				printf("0");
//				return 0;
//			}
//		}
//		else {
//		}
	}
//	printf("\n");
	queue<int> q;
	q.push(0);
	tot = 0;
	while (!q.empty()) {
		int t = q.front();
//		printf("%d\n", t);
		q.pop();
		int tt = t;
		while (tt) {
			++tot;
			ans[tot] = tt;
			tt = son[tt];
		}
		for (int i = 0; i < (int)edge[t].size(); ++i) {
			int to = edge[t][i];
			--in[to];
			if (!in[to]) {
				q.push(to);
			}
		}
	}
//	for (int i = 1; i <= n; ++i) {
//		printf("%d ", in[i]);
//	}
//	for (int i = 1; i <= n; ++i) {
//		if (father[i] == i) {
//			printf("%d %d\n", i, in[i]);
//		}
//	}
	if (tot < n) {
//		printf("%d", tot);
		printf("0");
		return 0;
	}
	vis[0] = 1;
	for (int i = 1; i <= n; ++i) {
		vis[ans[i]] = 1;
		if (!vis[p[ans[i]]]) {
			printf("0");
			return 0;
		}
	}
//	printf("%d\n", tot);
	for (int i = 1; i <= n; ++i) {
		printf("%d ", ans[i]);
	}
}