#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long linf = 0x3f3f3f3f3f3f3f3f;
const long long mod = 998244353LL;
const int maxn = 2e5 + 10;
vector<pair<int, int>> g[maxn];
vector<int> ans;
int w[maxn], sum[maxn];
bool vis[maxn], usd[maxn];
queue<int> q;
void solve() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &w[i]);
  }
  for (int i = 1; i <= m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    ++sum[x];
    ++sum[y];
    g[x].push_back(make_pair(y, i));
    g[y].push_back(make_pair(x, i));
  }
  for (int i = 1; i <= n; ++i) {
    if (sum[i] <= w[i]) {
      q.push(i);
      vis[i] = true;
    }
  }
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    int sz = g[x].size();
    for (int j = 0; j < sz; ++j) {
      int y = g[x][j].first;
      int id = g[x][j].second;
      if (!usd[id]) {
        ans.push_back(id);
        usd[id] = true;
      }
      --sum[y];
      if (!vis[y] && sum[y] <= w[y]) {
        q.push(y);
        vis[y] = true;
      }
    }
  }
  if ((int)(ans.size()) < m) {
    puts("DEAD");
    return;
  }
  puts("ALIVE");
  for (int i = m - 1; i >= 0; --i) {
    if (i < m - 1) printf(" ");
    printf("%d", ans[i]);
  }
  puts("");
}
int main() {
  solve();
  return 0;
}
