#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
using namespace std;
const long long MAX = -1000000000000000000;
const long long MIN = 1000000000000000000;
const long long inf = 1000000000;
const long long KOK = 100000;
const long long LOG = 30;
const long long li = 500005;
const long long mod = 1000000007;
int n, m, b[li], a[li], k, flag, t, fa[li], si[li], vis[li], visit[li], x[li],
    y[li], use[li];
int cev;
queue<int> q;
set<pair<long long, long long> > st;
string s;
vector<int> v[li], vec;
inline int dsu(int x) {
  if (x == fa[x]) return x;
  return fa[x] = dsu(fa[x]);
}
int main(void) {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= k; i++) {
    scanf("%d %d", &x[i], &y[i]);
    use[x[i]]++;
    use[y[i]]++;
    v[x[i]].push_back(i);
    v[y[i]].push_back(i);
  }
  for (int i = 1; i <= k; i++) {
    if (use[x[i]] <= a[x[i]] || use[y[i]] <= a[y[i]]) q.push(i);
  }
  while (q.size()) {
    int node = q.front();
    q.pop();
    if (vis[node]) continue;
    vis[node] = 1;
    vec.push_back(node);
    use[x[node]]--;
    use[y[node]]--;
    int nodee = node;
    node = x[node];
    for (int i = 0; i < (int)v[node].size(); i++) {
      if ((use[x[v[node][i]]] <= a[x[v[node][i]]] ||
           use[y[v[node][i]]] <= a[y[v[node][i]]]) &&
          vis[v[node][i]] == 0)
        q.push(v[node][i]);
    }
    node = y[nodee];
    for (int i = 0; i < (int)v[node].size(); i++) {
      if ((use[x[v[node][i]]] <= a[x[v[node][i]]] ||
           use[y[v[node][i]]] <= a[y[v[node][i]]]) &&
          vis[v[node][i]] == 0)
        q.push(v[node][i]);
    }
  }
  if ((int)vec.size() != k) {
    printf("DEAD\n");
    return 0;
  }
  printf("ALIVE\n");
  reverse(vec.begin(), vec.end());
  for (int i = 0; i < (int)vec.size(); i++) {
    printf("%d ", vec[i]);
  }
  return 0;
}
