#include <bits/stdc++.h>
using namespace std;
int n, m, v[111], aux[111], hero[111], seen[111], id[111];
bool can(int point, int x) {
  int sum = hero[x];
  int s = point <= x ? -1 : 1;
  for (int i = x; ((s < 0) ? i >= point : i <= point); i += s) {
    sum += aux[i];
    if (sum < 0) return false;
  }
  return true;
}
void vai(int point, int x) {
  if (x <= point) {
    for (int i = x; i <= point; i++) aux[i] = 0;
  } else {
    for (int i = x; i >= point; i--) aux[i] = 0;
  }
}
void testa(int point) {
  for (int i = 1; i <= n; i++) aux[i] = v[i], seen[i] = 0;
  vector<int> vet;
  for (int i = 1; i <= m; i++) {
    int flag = false;
    for (int j = 1; j <= n; j++) {
      if (hero[j] && !seen[j] && can(point, j)) {
        vai(point, j);
        vet.push_back(id[j]);
        seen[j] = 1;
        flag = true;
        break;
      }
    }
    if (!flag) return;
  }
  printf("%d\n", point);
  for (int x : vet) {
    printf("%d ", x);
  }
  printf("\n");
  exit(0);
}
void solve() {
  for (int point = 1; point <= n; point++) {
    testa(point);
  }
  printf("-1\n");
}
int main() {
  scanf("%d %d", &n, &m);
  int a, b;
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &a, &b);
    hero[a] = b;
    id[a] = i;
  }
  for (int i = 1; i <= n; i++) scanf("%d", &v[i]);
  solve();
}
