#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<int> topic(n);
  map<int, vector<int>> topic2id;
  set<int> topicset;
  for (int i = 0; i < n; i++) {
    cin >> topic[i];
    topic2id[topic[i]].push_back(i);
    topicset.insert(topic[i]);
  }
  if (*topicset.rbegin() - *topicset.begin() + 1 != topicset.size()) {
    cout << -1 << "\n";
    return 0;
  }
  int mx_topic = *topicset.rbegin();
  vector<int> color(n, 0);
  int ok = 1;
  for (int i = 1; i <= mx_topic; i++) {
    for (auto id : topic2id[i]) {
      set<int> vis;
      for (auto nei : g[id]) {
        vis.insert(color[nei]);
      }
      int curok = 1;
      for (int j = 1; j <= i - 1; j++) {
        if (!vis.count(j)) curok = 0;
      }
      if (vis.count(i)) curok = 0;
      if (!curok) {
        ok = 0;
        break;
      }
      color[id] = i;
    }
    if (!ok) break;
  }
  if (!ok)
    cout << -1 << "\n";
  else {
    for (int i = 1; i <= mx_topic; i++) {
      for (auto id : topic2id[i]) {
        cout << id + 1 << " ";
      }
    }
    cout << "\n";
  }
  return 0;
}
