#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const double PI = 2 * acos(0);
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int w[n + 1];
  set<int> cnt[n + 1];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &w[i]);
  }
  int x[m + 1], y[m + 1];
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x[i], &y[i]);
    cnt[x[i]].insert(i);
    cnt[y[i]].insert(i);
  }
  bool ada = 0;
  queue<int> q;
  for (int i = 1; i <= n; i++) {
    if (w[i] >= cnt[i].size()) q.push(i);
  }
  stack<int> ans;
  if (!q.empty()) {
    while (!q.empty()) {
      set<int> tmp;
      int idx = q.front();
      q.pop();
      vector<int> v;
      for (auto j : cnt[idx]) {
        v.push_back(j);
      }
      for (auto j : v) {
        cnt[x[j]].erase(j);
        if (w[x[j]] >= cnt[x[j]].size()) tmp.insert(x[j]);
        cnt[y[j]].erase(j);
        if (w[y[j]] >= cnt[y[j]].size()) tmp.insert(y[j]);
        ans.push(j + 1);
      }
      for (auto i : tmp) q.push(i);
    }
    if (ans.size() < m) {
      printf("DEAD\n");
      return 0;
    }
    bool awal = 1;
    printf("ALIVE\n");
    while (!ans.empty()) {
      if (!awal) printf(" ");
      awal = 0;
      printf("%d", ans.top());
      ans.pop();
    }
  } else
    printf("DEAD\n");
}
