#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  vector<pair<long long, long long>> have(m);
  vector<set<long long>> ob(n);
  vector<bool> used(n, 0);
  vector<long long> w(n);
  vector<long long> ans;
  deque<long long> q;
  for (long long i = 0; i < n; i++) {
    cin >> w[i];
  }
  for (long long i = 0; i < m; i++) {
    cin >> have[i].first >> have[i].second;
    have[i].first--, have[i].second--;
    ob[have[i].first].insert(i);
    ob[have[i].second].insert(i);
  }
  for (long long i = 0; i < n; i++) {
    if (w[i] >= (long long)ob[i].size()) {
      q.push_back(i);
      used[i] = 1;
    }
  }
  while ((long long)q.size() > 0) {
    auto rsm = q.front();
    q.pop_front();
    auto now = ob[rsm];
    for (auto x : now) {
      ans.push_back(x);
      ob[have[x].first].erase(x);
      if (!used[have[x].first] &&
          (long long)ob[have[x].first].size() <= w[have[x].first]) {
        q.push_back(have[x].first);
        used[have[x].first] = 1;
      }
      ob[have[x].second].erase(x);
      if (!used[have[x].second] &&
          (long long)ob[have[x].second].size() <= w[have[x].second]) {
        q.push_back(have[x].second);
        used[have[x].second] = 1;
      }
    }
  }
  if ((long long)ans.size() != m) {
    cout << "DEAD";
    return 0;
  }
  cout << "ALIVE" << '\n';
  reverse(ans.begin(), ans.end());
  for (auto x : ans) cout << x + 1 << " ";
}
