#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> w(n);
  for (int i = 0; i < n; i++) cin >> w[i];
  vector<set<int>> like(n);
  vector<vector<int>> fav(m);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    fav[i] = {a, b};
    like[a].insert(i);
    like[b].insert(i);
  }
  vector<int> done(n);
  queue<int> q;
  vector<int> ans;
  for (int i = 0; i < n; i++) {
    if (w[i] >= like[i].size()) done[i] = 1, q.push(i);
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int x : like[u]) {
      ans.push_back(x + 1);
      for (int y : fav[x]) {
        if (y != u) {
          like[y].erase(x);
          if (w[y] >= like[y].size() && !done[y]) q.push(y), done[y] = 1;
        }
      }
    }
    like[u].clear();
  }
  if (ans.size() != m) {
    cout << "DEAD\n";
    return;
  }
  cout << "ALIVE\n";
  reverse(ans.begin(), ans.end());
  for (int i : ans) cout << i << " ";
  cout << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
