#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e16;
const long long MOD = 1e9 + 7;
struct th {
  int first;
  int second;
  int ind;
};
bool cmp(const th &a, const th &b) {
  return max(a.first, a.second) < max(b.first, b.second);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << setprecision(30);
  int n, m;
  cin >> n >> m;
  vector<long long> a(n);
  map<long long, vector<int>> mp;
  for (auto &i : a) {
    cin >> i;
  }
  vector<th> f(m);
  for (int i = 0; i < m; ++i) {
    cin >> f[i].first >> f[i].second;
    --f[i].first;
    --f[i].second;
    mp[f[i].first].push_back(i);
    mp[f[i].second].push_back(i);
  }
  auto b = a;
  for (auto &i : f) {
    --b[i.first];
    --b[i.second];
  }
  queue<int> pos;
  vector<char> used(m, false);
  for (int i = 0; i < n; ++i) {
    if (b[i] >= 0) pos.push(i);
  }
  vector<int> ans;
  while (!pos.empty()) {
    int cur = pos.front();
    pos.pop();
    for (auto &i : mp[cur]) {
      if (used[i]) continue;
      used[i] = true;
      ans.push_back(i + 1);
      ++b[f[i].first];
      if (b[f[i].first] == 0) pos.push(f[i].first);
      ++b[f[i].second];
      if (b[f[i].second] == 0) pos.push(f[i].second);
    }
  }
  bool ok = true;
  for (auto &i : used)
    if (!i) ok = false;
  if (!ok) {
    cout << "DEAD";
    return 0;
  }
  cout << "ALIVE\n";
  reverse(ans.begin(), ans.end());
  for (auto &i : ans) cout << i << ' ';
  return 0;
}
