#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
int am[MAXN], w[MAXN], did[MAXN], pas[MAXN];
vector<int> g[MAXN], v[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) cin >> w[i];
  for (int i = 0, ThxDem = m; i < ThxDem; ++i) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    am[x]++;
    am[y]++;
    v[i].push_back(x);
    v[i].push_back(y);
    g[x].push_back(i);
    g[y].push_back(i);
  }
  vector<int> ans, q;
  for (int i = 0, ThxDem = n; i < ThxDem; ++i)
    if (w[i] >= am[i]) did[i] = 1, q.push_back(i);
  while (int(q.size())) {
    int wh = q.back();
    q.pop_back();
    for (auto x : g[wh])
      if (!pas[x]) {
        ans.push_back(x);
        pas[x] = 1;
        for (auto i : v[x]) {
          am[i]--;
          if (am[i] <= w[i] && !did[i]) q.push_back(i), did[i] = 1;
        }
      }
  }
  if (int(ans.size()) != m)
    cout << "DEAD\n";
  else {
    cout << "ALIVE\n";
    reverse(ans.begin(), ans.end());
    for (auto x : ans) cout << x + 1 << " ";
    cout << "\n";
  }
}
