#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using u64 = uint64_t;
using u32 = uint32_t;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;
static constexpr int INF = (int)1e9 + 5;
static constexpr ll INFL = (ll)1e18 + 5;
static mt19937 rng((u32)chrono::duration_cast<chrono::nanoseconds>(
                       chrono::high_resolution_clock::now().time_since_epoch())
                       .count());
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vi w(n), deg(n);
  for (auto& wi : w) cin >> wi;
  vector<vpi> adj(n);
  for (int i = 0; i < (m); ++i) {
    int x, y;
    cin >> x >> y, --x, --y;
    adj[x].emplace_back(y, i);
    adj[y].emplace_back(x, i);
    deg[x]++;
    deg[y]++;
  }
  vi cand;
  vector<bool> done(n), inq(n);
  for (int i = 0; i < (n); ++i)
    if (w[i] >= deg[i]) cand.push_back(i), inq[i] = true;
  vi res;
  while (((int)(cand).size())) {
    int v = cand.back();
    cand.pop_back();
    done[v] = true;
    for (auto [v2, ei] : adj[v]) {
      if (done[v2]) continue;
      res.push_back(ei);
      if (--deg[v2] <= w[v2] && !inq[v2]) cand.push_back(v2), inq[v2] = true;
    }
  }
  if (((int)(res).size()) == m) {
    cout << "ALIVE\n";
    reverse((res).begin(), (res).end());
    for (auto& ri : res) cout << (ri + 1) << ' ';
    cout << '\n';
  } else
    cout << "DEAD\n";
  return 0;
}
