#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pa;
const int M = 3e5 + 10;

int n, k, p[M], l[M], r[M], deg[M], is[M], pos[M];
vector<int> v[M];
vector<int> G[M];

void solve() {
    cin >> n >> k;
    for (int i = 1; i <= n; ++i) cin >> p[i];
    int flag = 1;
    for (int i = 1; i <= k; ++i) {
        int x, y;
        cin >> x >> y;
        if (l[y] || r[x]) {
            flag = 0;
        }
        l[y] = x;
        r[x] = y;
    }
    if (!flag) {
        cout << "0\n";
        return;
    }
    for (int i = 1; i <= n; ++i) {
        if (!l[i]) {
            if (r[i]) {
                v[i].push_back(i);
                is[i] = i;
                int cnt = 0;
                pos[i] = ++cnt;
                int ti = r[i];
                while (ti) {
                    v[i].push_back(ti);
                    is[ti] = i;
                    pos[ti] = ++cnt;
                    ti = r[ti];
                }
            }
        }
    }
    for (int i = 1; i <= n; ++i) {
        if ((r[i] || l[i]) && !is[i]) {
            cout << "0\n";
            return;
        }
    }
    // for (int i = 1; i <= n; ++i) cout << is[i] << '\n';
    for (int i = 1; i <= n; ++i) {
        int tp = p[i], ti = i;
        if (!tp) continue;
        if (is[tp]) tp = is[tp];
        if (is[ti]) ti = is[ti];
        if (tp == ti) {
            if (pos[p[i]] < pos[i]) continue;
            else {
                cout << "0\n";
                return;
            }
        }
        G[tp].push_back(ti);
        ++deg[ti];
    }
    queue<int> que;
    for (int i = 1; i <= n; ++i) {
        int ti = i;
        if (is[ti]) ti = is[ti];
        if (!deg[ti] && i == ti) que.push(ti);
    }
    // for (int i = 1; i <= n; ++i) cout << is[i] << '\n';
    vector<int> ans;
    while (que.size()) {
        int t = que.front();
        que.pop();
        // cout << t << '\n';
        if (is[t]) {
            for (auto x : v[t]) {
                ans.push_back(x);
            }
        } else {
            ans.push_back(t);
        }
        for (auto x : G[t]) {
            --deg[x];
            if (!deg[x]) {
                que.push(x);
            }
        }
    }
    if (ans.size() == n) {
        for (int i = 0; i < n; ++i) {
            cout << ans[i] <<  " \n"[i == n - 1];
        }
    } else {
        cout << "0\n";
    }
}

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







#ifdef Local
    cout << flush;
    system("pause");
#endif
}