#include <bits/stdc++.h>
using namespace std;
struct node {
  bool used = 0;
  vector<pair<long long, long long>> edjes;
};
vector<node> g;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  g.resize(n);
  vector<long long> ctr(n), w(n);
  for (long long i = 0; i < n; i++) cin >> w[i];
  vector<pair<long long, long long>> edges;
  for (long long i = 0; i < m; i++) {
    long long a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].edjes.push_back({i, b});
    g[b].edjes.push_back({i, a});
    ctr[a]++;
    ctr[b]++;
    edges.push_back({a, b});
  }
  queue<long long> order;
  vector<long long> ans;
  vector<bool> used(m);
  for (long long i = 0; i < n; i++) {
    if (w[i] - ctr[i] >= 0) {
      order.push(i);
      g[i].used = 1;
    }
  }
  while (!order.empty()) {
    long long v = order.front();
    order.pop();
    for (auto &i : g[v].edjes) {
      if (used[i.first]) continue;
      used[i.first] = 1;
      ans.push_back(i.first);
      ctr[i.second]--;
      if (ctr[i.second] == w[i.second] && !g[i.second].used) {
        order.push(i.second);
        g[i.second].used = 1;
      }
    }
  }
  reverse((ans).begin(), (ans).end());
  if (ans.size() < m) {
    cout << "DEAD";
    return 0;
  }
  for (auto &i : ans) {
    if (w[edges[i].first] <= 0 && w[edges[i].second] <= 0) {
      cout << "DEAD";
      return 0;
    }
    w[edges[i].first]--;
    w[edges[i].second]--;
  }
  cout << "ALIVE" << '\n';
  for (auto &i : ans) cout << i + 1 << " ";
  return 0;
}
