#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 10;
long long used[maxn], del[2 * maxn], deg[maxn], first[2 * maxn],
    second[2 * maxn];
long long w[maxn];
vector<long long> g[maxn];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) {
    cin >> w[i];
  }
  queue<long long> q;
  for (long long i = 0; i < m; i++) {
    cin >> first[i] >> second[i];
    g[first[i]].push_back(i);
    g[second[i]].push_back(i);
  }
  for (long long i = 1; i <= n; i++) {
    deg[i] = (long long)(g[i]).size();
    if ((long long)(g[i]).size() <= w[i]) {
      q.push(i);
    }
  }
  vector<long long> ans;
  while (!q.empty()) {
    long long v = q.front();
    used[v] = 1;
    q.pop();
    for (auto i : g[v]) {
      if (del[i]) continue;
      long long u = (first[i] == v ? second[i] : first[i]);
      deg[u]--, deg[v]--;
      del[i] = 1;
      ans.push_back(i + 1);
      if (used[u]) continue;
      if (deg[u] <= w[u]) {
        q.push(u);
      }
    }
  }
  reverse((ans).begin(), (ans).end());
  if ((long long)(ans).size() == m) {
    cout << "ALIVE\n";
    for (auto &el : ans) {
      cout << el << ' ';
    }
    cout << '\n';
  } else {
    cout << "DEAD\n";
  }
  return 0;
}
