#include <bits/stdc++.h>
using namespace std;
const int MAXN = 102;
int n, m, a[MAXN], asum[MAXN], asumr[MAXN], order[MAXN];
struct hero {
  int x, hp, id;
  bool operator<(const hero &rhs) const { return x < rhs.x; }
} h[MAXN];
queue<int> ans, weakman;
void Lgo(int pos) {
  int i, j = pos, k, nextPos, HPlose, lmx;
  for (i = 1; i <= m; i++)
    if (h[i].x > pos) break;
  for (i--; i > 0; i--) {
    HPlose = lmx = 0;
    for (k = h[i].x; k <= j; k++) {
      HPlose -= a[k];
      lmx = max(lmx, HPlose);
    }
    if (h[i].hp >= HPlose && h[i].hp >= lmx) {
      ans.push(h[i].id);
      HPlose = 0;
      j = h[i].x - 1;
    } else
      weakman.push(h[i].id);
  }
  while (!weakman.empty()) {
    ans.push(weakman.front());
    weakman.pop();
  }
}
void Rgo(int pos) {
  int i, j = pos, k, lmx, nextPos, HPlose = 0;
  for (i = m; i > 0; i--)
    if (h[i].x < pos) break;
  for (i++; i <= m; i++) {
    HPlose = lmx = 0;
    for (k = h[i].x; k >= j; k--) {
      HPlose -= a[k];
      lmx = max(lmx, HPlose);
    }
    if (h[i].hp >= HPlose && h[i].hp >= lmx) {
      ans.push(h[i].id);
      HPlose = 0;
      j = h[i].x + 1;
    } else
      weakman.push(h[i].id);
  }
  while (!weakman.empty()) {
    ans.push(weakman.front());
    weakman.pop();
  }
}
bool gol(int &HP, int l, int r) {
  int i;
  bool f = 1;
  for (i = l; i <= r; i++) {
    HP += a[i];
    if (HP < 0) f = 0;
  }
  return f;
}
bool gor(int &HP, int l, int r) {
  int i;
  bool f = 1;
  for (i = r; i >= l; i--) {
    HP += a[i];
    if (HP < 0) f = 0;
  }
  return f;
}
bool check(int pos) {
  int i, nextPos, maxHPL = -214748364, maxHPR = -214748364;
  for (i = 1; i <= m; i++) {
    if (h[i].x > pos) break;
    maxHPL = max(maxHPL, h[i].hp);
    nextPos = h[i + 1].x;
    if (i == m || nextPos > pos) nextPos = pos;
    if (!gol(maxHPL, h[i].x + 1, nextPos) &&
        (nextPos != pos || a[nextPos] >= 0))
      return 0;
  }
  for (i = m; i > 0; i--) {
    if (h[i].x < pos) break;
    maxHPR = max(maxHPR, h[i].hp);
    nextPos = h[i - 1].x;
    if (i == 1 || nextPos < pos) nextPos = pos;
    if (!gor(maxHPR, nextPos, h[i].x - 1) &&
        (nextPos != pos || a[nextPos] >= 0))
      return 0;
  }
  if ((maxHPL < 0 && maxHPR < 0) || (a[pos] > 0 && (maxHPL < 0 || maxHPR < 0)))
    return 0;
  if (a[pos] <= 0 && (maxHPR - a[pos] < 0 || maxHPL - a[pos] < 0)) return 0;
  if (maxHPL < maxHPR) {
    Rgo(pos);
    Lgo(pos - 1);
  } else {
    Lgo(pos);
    Rgo(pos + 1);
  }
  return 1;
}
int main() {
  int i;
  cin >> n >> m;
  for (i = 1; i <= m; i++) {
    cin >> h[i].x >> h[i].hp;
    h[i].id = i;
  }
  sort(h + 1, h + m + 1);
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    asum[i] = a[i] + asum[i - 1];
  }
  for (i = n; i > 0; i--) asumr[i] = a[i] + asumr[i + 1];
  for (i = n; i > 0; i--)
    if (check(i)) break;
  if (i < 1)
    cout << -1;
  else {
    cout << i << endl << ans.front();
    ans.pop();
    while (!ans.empty()) {
      cout << " " << ans.front();
      ans.pop();
    }
  }
}
