#include <bits/stdc++.h>
using namespace std;
template <class T>
void printvec(vector<T>& x, int a, int b) {
  for (int i = (a); i <= (b); i++) cout << x[i] << " ";
  cout << "\n";
}
const double PI = acos((double)-1);
const double EPSILON = 1e-7;
const int N = 2e6 + 1;
const int NN = 1e3 + 1;
const long long MOD = 1e9 + 7;
const long long oo = LLONG_MAX;
const int BASE = 10000;
const int di[4] = {-1, 0, 1, 0};
const int dj[4] = {0, 1, 0, -1};
void query() {
  int n, m;
  cin >> n >> m;
  vector<int> w(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  vector<pair<int, int>> e(m + 1);
  vector<set<int>> like(n + 1);
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    w[u]--;
    w[v]--;
    e[i] = {u, v};
    like[u].insert(i);
    like[v].insert(i);
  }
  set<pair<int, int>, greater<pair<int, int>>> s;
  for (int i = 1; i <= n; i++) {
    s.insert({w[i], i});
  }
  vector<int> res;
  vector<int> check(n + 1);
  while ((int)(s).size()) {
    pair<int, int> cur = *s.begin();
    if (check[cur.second]) {
      s.erase(s.begin());
      continue;
    }
    if (cur.first < 0) {
      break;
    }
    for (int x : like[cur.second]) {
      res.push_back(x);
      int adj = (e[x].first == cur.second ? e[x].second : e[x].first);
      like[adj].erase(x);
      w[adj]++;
      s.insert({w[adj], adj});
    }
    check[cur.second] = 1;
    s.erase(cur);
  }
  if ((int)(res).size() < m) {
    cout << "DEAD"
         << "\n";
    return;
  }
  cout << "ALIVE"
       << "\n";
  reverse((res).begin(), (res).end());
  for (int x : res) {
    cout << x << " ";
  }
}
void solve() {
  int t = 1;
  while (t--) {
    query();
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << fixed << setprecision(10);
  solve();
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  return 0;
}
