#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 2;
const int M = 2e5 + 2;
const int INF = 1e9;
int n, m;
int W[N], cnt[N];
bool vis[M];
vector<int> res;
vector<pair<int, int> > adj[N];
void remove(int cur) {
  if (W[cur] < cnt[cur]) return;
  W[cur] = -INF;
  for (pair<int, int> nx : adj[cur]) {
    cnt[nx.first]--;
    cnt[nx.first] = max(0, cnt[nx.first]);
    if (!vis[nx.second]) res.push_back(nx.second);
    vis[nx.second] = 1;
    remove(nx.first);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  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++) {
    int u, v;
    cin >> u >> v;
    cnt[u]++;
    cnt[v]++;
    adj[u].push_back({v, i});
    adj[v].push_back({u, i});
  }
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++) {
    remove(i);
  }
  if (res.size() != m) {
    cout << "DEAD\n";
    return 0;
  }
  cout << "ALIVE\n";
  reverse(res.begin(), res.end());
  for (int i : res) {
    cout << i << ' ';
  }
  cout << '\n';
  return 0;
}
