#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 200005;
const long long MAXLOG = log2(MAXN);
const long long oo = 1000000005;
const unsigned long long OO = 1000000000000000005;
const double pi = acos(-1.0);
const double EPS = 1e-4;
const long long dr[4] = {-1, 0, 1, 0};
const long long dc[4] = {0, 1, 0, -1};
const long long dr8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const long long drknight[8] = {-2, -1, 1, 2, 2, 1, -1, -2};
const long long dcknight[8] = {1, 2, 2, 1, -1, -2, -2, -1};
const long long MOD = 1000000007;
const long long ALPHABET_SIZE = 52;
const long long MAX = 1000005;
long long n, m;
long long a[MAXN], b[MAXN];
vector<pair<long long, long long> > g[MAXN];
pair<long long, long long> p[MAXN];
bool mk[MAXN];
bool ok;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  vector<long long> res;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < m; i++) {
    cin >> p[i].first >> p[i].second;
    b[p[i].first]++;
    b[p[i].second]++;
    g[p[i].first].push_back({i, p[i].second});
    g[p[i].second].push_back({i, p[i].first});
  }
  queue<long long> q;
  for (long long i = 1; i <= n; i++) {
    if (a[i] >= b[i] and a[i] > 0) {
      ok = 1;
      q.push(i);
    }
  }
  if (!ok) {
    cout << "DEAD";
    return 0;
  }
  while (!q.empty()) {
    long long u = q.front();
    q.pop();
    if (a[u] < b[u]) {
      cout << "DEAD";
      return 0;
    }
    for (auto e : g[u]) {
      long long v = e.second, j = e.first;
      if (mk[j]) continue;
      mk[j] = 1;
      a[u]--;
      b[u]--;
      b[v]--;
      res.push_back(j);
      if (a[v] >= b[v]) q.push(v);
    }
  }
  for (long long i = 1; i <= n; i++) {
    if (a[i] < 0) ok = 0;
  }
  if (!ok or res.size() != m) {
    cout << "DEAD";
    return 0;
  }
  cout << "ALIVE\n";
  for (long long i = res.size() - 1; i >= 0; i--) {
    cout << res[i] + 1 << " ";
  }
  return 0;
}
