#include "bits/stdc++.h"
using namespace std;

#define ffor(n) for(int i = 0; i < n; i++)
#define fffor(n) for(int j = 0; j < n; j++)
#define uwu ios_base::sync_with_stdio(false);cin.tie(NULL);
#pragma GCC optimize("Ofast")

const int INF = 1e9 + 7;
const long long INF2 = 1e15;

void solve(void) {
	
}

bool valid = true;

void verify(int current, vector <vector <int>>& asd, vector <int>& state, vector <int>& res) {
	if (valid == false) return;
	if (state[current] == 1) {
		valid = false;
		return;
	}
	if (state[current] == 2) return;
	if (state[current] == 0) {
		state[current] = 1;
		for (int nextnode: asd[current]) {
			verify(nextnode, asd, state, res);
		}
		state[current] = 2;
		res.push_back(current);
	}
}


int main(void) {
	uwu

	int n, k;
	cin >> n >> k;
	vector <int> v(n);
	ffor(n) cin >> v[i];
	vector <pair <int, int>> v2(k);
	ffor(k) cin >> v2[i].first >> v2[i].second;

	set <pair <int, int>> edges;
	ffor(n) {
		if (v[i] != 0) edges.insert({v[i] - 1, i});
	}
	ffor(k) {
		edges.insert({v2[i].first - 1, v2[i].second - 1});
	}
	
	// next in chain
	vector <int> next(n, -1), prev(n, -1);
	for(int i = 0; i < k; i++) {
		next[v2[i].first - 1] = v2[i].second - 1;
		prev[v2[i].second - 1] = v2[i].first - 1;
	}
	vector <int> chained(n, -1); 
	for(int i = 0; i < n; i++) {
		if (chained[i] != -1) continue;
		auto head = i, tail = i;
		chained[i] = i;
		while(prev[head] != -1) {
			if (chained[prev[head]] != -1) {
				valid = false;
				break;
			}
			head = prev[head];
			chained[head] = i;
		}
		while(next[tail] != -1) {
			if (chained[next[tail]] != -1) {
				valid = false;
				break;
			}
			tail = next[tail];
			chained[tail] = i;
		}
		while(tail != head) {
			if (v[tail] != 0 && chained[v[tail] - 1] != i) {
				edges.insert({v[tail] - 1, head});
			}
			tail = prev[tail];
		}
	}
	
	// adjacency list
	vector <vector <int>> asd(n);
	for(auto e: edges) {
		asd[e.first].push_back(e.second);
	}
	
	// topological sort
	vector <int> state(n), res;
	for(int i = 0; i < n; i++) {
		if (v[i] == 0) {
			verify(i, asd, state, res);
		}
	}
	
	vector <bool> visited(n);
	reverse(res.begin(), res.end()); // reverse reversed topological sort
	vector <int> ans, order_of(n);
	
	
	for(int e: res) {
		auto current = e;
		if (visited[current]) continue;
		// follow chain
		while(next[current] != -1 && visited[next[current]] != true) {
			ans.push_back(current);
			visited[current] = true;
			current = next[current];
		}
		ans.push_back(current);
		visited[current] = true;
		current = next[current];
	}
		
	if (valid) {
		// find position in answer
		for(int i = 0; i < ans.size(); i++) {
			order_of[ans[i]] = i;
		}
		// verify ordering
		for(int i = 0; i < v.size(); i++) {
			if (v[i] == 0) continue;
			if (order_of[v[i] - 1] > order_of[i]) valid = false;
		}
		for(int i = 0; i < k; i++) {
			if (order_of[v2[i].first - 1] + 1 != order_of[v2[i].second - 1]) valid = false;
		}
		if (valid) {
			for (auto e: ans) cout << e + 1 << ' ';
			cout << '\n';
		}
		else cout << 0 << '\n';
	}
	else cout << 0 << '\n';
}	







/*
C:\Users\User\Desktop\comp_programming\final_straw_after_this_im_switching_to_vs_code\finally_switched_to_geany.cpp
*/
