#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 50;
int N, M, w[maxn], du[maxn];
vector<pair<int, int> > edge[maxn];
void solve() {
  cin >> N >> M;
  for (int i = 1; i <= N; i++) cin >> w[i];
  for (int i = 1; i <= M; i++) {
    int x, y;
    cin >> x >> y;
    edge[x].push_back(make_pair(y, i));
    edge[y].push_back(make_pair(x, i));
    du[x]++;
    du[y]++;
  }
  queue<int> que;
  vector<bool> vis(M + 1);
  vector<bool> in_que(N + 1);
  vector<int> ans;
  for (int i = 1; i <= N; i++) {
    if (du[i] <= w[i]) {
      que.push(i);
      in_que[i] = true;
    }
  }
  int sum = 0;
  while (!que.empty()) {
    int now = que.front();
    que.pop();
    for (int i = 0; i < edge[now].size(); i++) {
      pair<int, int> cnt = edge[now][i];
      if (vis[cnt.second] == true) continue;
      vis[cnt.second] = true;
      ans.push_back(cnt.second);
      sum++;
      du[cnt.first]--;
      if (du[cnt.first] <= w[cnt.first] && in_que[cnt.first] == false) {
        in_que[cnt.first] = true;
        que.push(cnt.first);
      }
    }
  }
  if (sum == M) {
    cout << "ALIVE" << endl;
    reverse(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  } else
    cout << "DEAD" << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
