#include <bits/stdc++.h>
using namespace std;
bool vis[200005];
vector<vector<long>> c;
long a[200005], b[200005], d[200005], cap[200005];
vector<long> ans;
void dfs(long idx) {
  if (vis[idx]) return;
  if (d[a[idx]] <= cap[a[idx]] || d[b[idx]] <= cap[b[idx]]) {
    d[a[idx]]--, d[b[idx]]--;
    vis[idx] = true;
    ans.push_back(idx);
    for (long &i : c[a[idx]]) dfs(i);
    for (long &i : c[b[idx]]) dfs(i);
  }
}
int main() {
  long n, m;
  cin >> n >> m;
  c.resize(n);
  for (long i = 0; i < n; i++) cin >> cap[i];
  for (long i = 0; i < m; i++) {
    long f1, f2;
    cin >> f1 >> f2;
    f1--, f2--;
    a[i] = f1, b[i] = f2;
    d[f1]++, d[f2]++;
    c[f1].push_back(i), c[f2].push_back(i);
  }
  memset(vis, false, sizeof(vis));
  for (long i = 0; i < m; i++) dfs(i);
  if ((long)(ans.size()) == m) {
    reverse(ans.begin(), ans.end());
    cout << "ALIVE" << '\n';
    for (long &i : ans) cout << i + 1 << " ";
  } else
    cout << "DEAD";
}
