#include <bits/stdc++.h>
using namespace std;
const int N = 200100;
int w[N];
int x[N], y[N];
int used[N];
int used_c[N];
int qtd[N], qtd2[N];
priority_queue<int> pq;
vector<int> E[N];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> w[i];
  }
  for (int i = 1; i <= m; ++i) {
    cin >> x[i] >> y[i];
    qtd[x[i]]++;
    E[x[i]].push_back(i);
    qtd[y[i]]++;
    E[y[i]].push_back(i);
  }
  for (int i = 1; i <= n; ++i) {
    qtd2[i] = qtd[i];
    if (w[i] >= qtd[i]) {
      pq.push(i);
      used_c[i] = 1;
    }
  }
  vector<int> ans;
  while (!pq.empty()) {
    int at = pq.top();
    pq.pop();
    for (int p : E[at]) {
      if (used[p] == 0) {
        qtd[x[p]]--;
        qtd[y[p]]--;
        if (used_c[x[p]] == 0 && w[x[p]] >= qtd[x[p]]) {
          pq.push(x[p]);
          used_c[x[p]] = 1;
        }
        if (used_c[y[p]] == 0 && w[y[p]] >= qtd[y[p]]) {
          pq.push(y[p]);
          used_c[y[p]] = 1;
        }
        used[p] = 1;
        ans.push_back(p);
      }
    }
  }
  int ok = 1;
  ok = ans.size() == m;
  if (ok) {
    puts("ALIVE");
    reverse(ans.begin(), ans.end());
    for (int p : ans) {
      printf("%d ", p);
    }
    printf("\n");
  } else {
    puts("DEAD");
  }
}
