#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <math.h>

using namespace std;

const int MAXN = 3e5 + 5;

int N, K, par[MAXN], sz[MAXN], nxt[MAXN], tr[MAXN], in[MAXN], ind[MAXN];
vector<int> adj[MAXN], comp[MAXN], roots;

int find(int p){
    while(p != par[p])
        p = par[p];
    return p;
}

void merge(int p, int q){
    p = find(p);
    q = find(q);
    if(p == q)
        return;
    if(sz[p] < sz[q]){
        par[p] = q;
        sz[q] += sz[p];
    }
    else{
        par[q] = p;
        sz[p] += sz[q];
    }
}

bool ok(){
    for(int i = 0; i < N; i++){
        if(nxt[i] != -1 && ind[nxt[i]] != ind[i] + 1)
            return false;
        for(int v: adj[i]){
            if(ind[v] < ind[i])
                return false;
        }
    }
    return true;
}

int main() {
     
    ios_base::sync_with_stdio(0);
    cin.tie (0);
    cout.tie (0);

    cin >> N >> K;
    for(int i = 0; i < N; i++){
        int p;
        cin >> p;
        p--;
        if(p != -1){
            adj[p].push_back(i);
        }
        sz[i] = 1;
        par[i] = i;
        nxt[i] = -1;
    }
    for(int i = 0; i < K; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        merge(a, b);
        if(nxt[a] != -1){
            cout << "0";
            return 0;
        }
        nxt[a] = b;
    }
    for(int i = 0; i < N; i++){
        tr[i] = find(i);
        comp[tr[i]].push_back(i);
        if(i == par[i])
            roots.push_back(i);
    }
    for(int i = 0; i < N; i++){
        for(int x: adj[i]){
            if(tr[x] != tr[i])
                in[tr[x]]++;
        }
    }
    vector<int> comporder;
    vector<int> s;
    for(int i: roots){
        if(in[i] == 0)
            s.push_back(i);
    }
    while(s.size()){
        int t = s.back();
        s.pop_back();
        for(int x: comp[t]){
            for(int y: adj[x]) if(tr[y] != t){
                in[tr[y]]--;
                if(in[tr[y]] == 0){
                    s.push_back(tr[y]);
                }
            }
        }
        comporder.push_back(t);
    }
    for(int i = 0; i < N; i++){
        in[i] = 0;
    }
    for(int i = 0; i < N; i++){
        in[nxt[i]]++;
    }
    vector<int> ans;
    for(int x: comporder){
        int start = -1;
        for(int y: comp[x])
            if(in[y] == 0){
                start = y;
                break;
            }
        while(start != -1){
            ans.push_back(start);
            start = nxt[start];
        }
    }
    if(ans.size() != N){
        cout << "0";
        return 0;
    }
    for(int i = 0; i < N; i++){
        ind[ans[i]] = i;
    }
    if(!ok()){
        cout << "0";
    }
    else{
        for(int x: ans){
            cout << x + 1 << " ";
        }
    }

    
}