#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  int W[N];
  for (int i = 0; i < (N); i++) cin >> W[i];
  int C[N];
  vector<pair<int, int> > E[N];
  for (int i = 0; i < (N); i++) {
    C[i] = 0;
  }
  for (int i = 0; i < (M); i++) {
    int A, B;
    cin >> A >> B;
    A--;
    B--;
    E[A].push_back({B, i});
    E[B].push_back({A, i});
    C[A]++;
    C[B]++;
  }
  bool found[M];
  for (int i = 0; i < (M); i++) found[i] = false;
  queue<int> q;
  for (int i = 0; i < (N); i++) {
    if (C[i] <= W[i]) {
      q.push(i);
    }
  }
  vector<int> ans;
  while (!q.empty()) {
    int c = q.front();
    q.pop();
    for (auto& a : E[c]) {
      if (!found[a.second]) {
        found[a.second] = true;
        ans.push_back(a.second);
        C[a.first]--;
        if (C[a.first] == W[a.first]) q.push(a.first);
      }
    }
  }
  if ((int)(ans).size() == M) {
    cout << "ALIVE" << nl;
    for (int i = (M)-1; i >= 0; i--) {
      cout << ans[i] + 1 << " ";
    }
    cout << nl;
  } else {
    cout << "DEAD" << nl;
  }
  return 0;
}
