#include <bits/stdc++.h>
using namespace std;
int n, m;
int w[100005], x[200005], y[200005];
vector<int> ans;
set<int> v[100005];
set<pair<int, int>> s;
void pop(int ind, int x) {
  s.erase(make_pair(v[ind].size() - w[ind], ind));
  v[ind].erase(x);
  s.insert(make_pair(v[ind].size() - w[ind], ind));
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> w[i];
  for (int i = 1; i <= m; i++)
    cin >> x[i] >> y[i], v[x[i]].insert(i), v[y[i]].insert(i);
  for (int i = 1; i <= n; i++) s.insert({v[i].size() - w[i], i});
  while (!s.empty()) {
    auto it = s.begin();
    if (it->first > 0) break;
    for (auto &i : v[it->second]) {
      ans.push_back(i);
      if (x[i] == it->second)
        pop(y[i], i);
      else
        pop(x[i], i);
    }
    s.erase(it);
  }
  reverse(ans.begin(), ans.end());
  if (ans.size() != m) {
    cout << "DEAD";
    return 0;
  }
  cout << "ALIVE\n";
  for (int i = 0; i < m; i++) cout << ans[i] << " ";
  return 0;
}
