#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, w[200005], cnt[200005];
vector<pair<int, int> > v[200005];
queue<int> q;
vector<int> ans;
bool vis[200005];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> w[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    v[x].push_back({i, y});
    v[y].push_back({i, x});
    cnt[x]++;
    cnt[y]++;
  }
  for (int i = 1; i <= n; i++) {
    if (w[i] >= cnt[i]) {
      q.push(i);
    }
  }
  while (!q.empty()) {
    x = q.front();
    q.pop();
    for (auto g : v[x]) {
      if (!vis[g.first]) {
        vis[g.first] = true;
        cnt[g.second]--;
        if (cnt[g.second] <= w[g.second]) {
          q.push(g.second);
        }
        ans.push_back(g.first);
      }
    }
  }
  if (ans.size() == m) {
    cout << "ALIVE\n";
    for (int i = m - 1; i >= 0; i--) {
      cout << ans[i] << " ";
    }
  } else {
    cout << "DEAD\n";
  }
}
