#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 7;
int n, m, w[N], ns[N], tot;
set<pair<int, int> > e[N];
queue<int> q;
bool vis[N];
int rmain() {
  cin >> n >> m;
  for (int i = 1, iE = n; i <= iE; i++) cin >> w[i];
  for (int t = 1, tE = m; t <= tE; t++) {
    int u, v;
    cin >> u >> v;
    e[u].insert(make_pair(v, t)), e[v].insert(make_pair(u, t));
  }
  for (int i = 1, iE = n; i <= iE; i++)
    if (((int)(e[i]).size()) <= w[i]) q.push(i), vis[i] = true;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (pair<int, int> v : e[u]) {
      e[v.first].erase(make_pair(u, v.second)), ns[++tot] = v.second;
      if (!vis[v.first] && ((int)(e[v.first]).size()) <= w[v.first])
        q.push(v.first), vis[v.first] = true;
    }
    e[u].clear();
  }
  if (tot == m) {
    cout << "ALIVE\n";
    for (int i = tot, iE = 1; i >= iE; i--) cout << ns[i] << " ";
    cout << "\n";
  } else
    cout << "DEAD\n";
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  rmain();
  return 0;
}
