#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T abs(T t) {
  return t < 0 ? -t : t;
}
const long long modn = 1000000007;
inline long long mod(long long x) { return x % modn; }
const int MAXN = 212345;
int n, m, k;
pair<int, int> s[MAXN];
int qtd[MAXN], saldo[MAXN];
int mrkf[MAXN], mrkp[MAXN];
vector<int> has[MAXN];
int main() {
  scanf("%d%d", &n, &m);
  for (int a = 1; a <= n; a++) {
    scanf("%d", qtd + a);
    saldo[a] = qtd[a];
    has[a].clear();
  }
  for (int a = 0; a < m; a++) {
    scanf("%d%d", &s[a].first, &s[a].second);
    has[s[a].first].push_back(a);
    has[s[a].second].push_back(a);
    saldo[s[a].first]--;
    saldo[s[a].second]--;
  }
  set<pair<int, int> > q;
  for (int a = 1; a <= n; a++) q.insert({-saldo[a], a});
  stack<int> ans;
  while (!q.empty()) {
    pair<int, int> p = *q.begin();
    q.erase(q.begin());
    int i = p.second;
    mrkf[i] = true;
    if (saldo[i] < 0) {
      puts("DEAD");
      return 0;
    }
    for (int u : has[i]) {
      if (mrkp[u]) continue;
      ans.push(u);
      mrkp[u] = 1;
      if (!mrkf[s[u].first]) {
        q.erase({-saldo[s[u].first], s[u].first});
        saldo[s[u].first]++;
        q.insert({-saldo[s[u].first], s[u].first});
      }
      if (!mrkf[s[u].second]) {
        q.erase({-saldo[s[u].second], s[u].second});
        saldo[s[u].second]++;
        q.insert({-saldo[s[u].second], s[u].second});
      }
    }
  }
  puts("ALIVE");
  while (!ans.empty()) {
    printf("%d ", 1 + ans.top());
    ans.pop();
  }
  puts("");
}
