#include <bits/stdc++.h>
using namespace std;
vector<int> v;
class tree {
 public:
  int n;
  vector<int> vis;
  vector<vector<int>> adj;
  tree(int n) : n(n) {
    adj = vector<vector<int>>(n);
    vis = vector<int>(n);
  }
  void add(int m) {
    for (int i = 0; i < m; i++) {
      int a, b;
      cin >> a >> b;
      adj[--a].push_back(--b);
      adj[b].push_back(a);
    }
  }
  int dfs(int root = 0, int parent = 0) {
    vis[root] = 1;
    int res = 1;
    set<int> s;
    if (root != parent) s.insert(v[parent]);
    for (auto i : adj[root]) {
      s.insert(v[i]);
      if (!vis[i]) {
        if (v[i] == v[root]) return -1;
        res = min(res, dfs(i, root));
      }
    }
    int x = 0;
    for (auto i : s)
      if (i == x) x++;
    if (x < v[root]) res = -1;
    return res;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  tree t(n);
  t.add(m);
  v = vector<int>(n);
  for (auto &i : v) cin >> i, --i;
  int res = 1;
  for (int i = 0; i < n; i++) {
    res = min(res, t.dfs(i, i));
  }
  if (res == -1) {
    cout << "-1\n";
    return 0;
  }
  vector<pair<int, int>> u;
  set<int> s;
  for (int i = 0; i < n; i++) {
    u.push_back({v[i], i});
  }
  sort(u.begin(), u.end());
  for (auto [i, j] : u) {
    cout << j + 1 << " ";
  }
  cout << "\n";
  return 0;
}
