#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> W(N), S(N);
  for (int i = 0; i < N; i++) cin >> W[i];
  vector<int> X(M), Y(M);
  vector<vector<int>> F2P(N);
  for (int i = 0; i < M; i++) {
    cin >> X[i] >> Y[i];
    X[i]--;
    Y[i]--;
    S[X[i]]++;
    S[Y[i]]++;
    F2P[X[i]].push_back(i);
    F2P[Y[i]].push_back(i);
  }
  vector<int> ans;
  vector<bool> used(M);
  queue<int> que;
  for (int i = 0; i < N; i++)
    if (W[i] >= S[i]) que.push(i);
  while (que.size()) {
    int i = que.front();
    que.pop();
    for (int p : F2P[i])
      if (!used[p]) {
        ans.push_back(p);
        used[p] = 1;
        for (int j : {X[p], Y[p]}) {
          S[j]--;
          if (W[j] == S[j]) que.push(j);
        }
      }
  }
  reverse(ans.begin(), ans.end());
  if (ans.size() == M) {
    cout << "ALIVE" << endl;
    for (int a : ans) cout << a + 1 << " ";
    cout << endl;
  } else {
    cout << "DEAD" << endl;
  }
  return 0;
}
