#include <bits/stdc++.h>
using namespace std;
const int mxn = 200000;
int n, m;
int a[mxn], vis[mxn], vis2[mxn];
vector<pair<int, int> > g[mxn];
queue<int> q;
vector<int> ans;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    g[u].push_back({v, i});
    g[v].push_back({u, i});
    a[u]--, a[v]--;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] >= 0) {
      vis[i] = 1;
      q.push(i);
    }
  }
  while (!q.empty()) {
    int c = q.front();
    q.pop();
    for (pair<int, int> i : g[c]) {
      if (!vis2[i.second]) {
        a[i.first]++;
        vis2[i.second] = 1;
        ans.push_back(i.second + 1);
        if (!a[i.first]) q.push(i.first);
      }
    }
  }
  if (ans.size() < m) {
    cout << "DEAD" << '\n';
  } else {
    cout << "ALIVE" << '\n';
    reverse(ans.begin(), ans.end());
    cout << ans[0];
    for (int i = 1; i < m; i++) cout << " " << ans[i];
    cout << '\n';
  }
  return 0;
}
