#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int w[N], sum[N];
vector<pair<int, int> > food[N];
int n, m;
queue<int> que;
stack<int> ans;
bool vis[N];
bool solve() {
  for (int i = 1; i <= n; i++) {
    if (sum[i] <= w[i]) que.push(i);
  }
  int cnt = 0;
  while (!que.empty()) {
    int t = que.front();
    que.pop();
    for (int i = 0; i < food[t].size(); i++) {
      int a = food[t][i].first;
      int b = food[t][i].second;
      if (vis[b]) continue;
      ans.push(b);
      vis[b] = 1;
      if (--sum[a] <= w[a]) que.push(a);
    }
  }
  return ans.size() == m;
}
int main() {
  int x, y;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    sum[x]++, sum[y]++;
    food[x].push_back(make_pair(y, i));
    food[y].push_back(make_pair(x, i));
  }
  if (solve()) {
    printf("ALIVE\n");
    while (!ans.empty()) {
      int t = ans.top();
      ans.pop();
      printf("%d%c", t, ans.empty() ? '\n' : ' ');
    }
    printf("\n");
  } else
    printf("DEAD\n");
  return 0;
}
