#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 5;
int a[maxn];
int b[maxn];
int c[maxn];
int f[maxn];
int stk[maxn];
bool vis[maxn];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int l = n + 1, r = 0;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &a[i], &b[i]);
    l = min(l, a[i]);
    r = max(r, a[i]);
    f[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) scanf("%d", &c[i]);
  int p = l;
  long long hp = b[f[p]];
  for (int i = l + 1; i < r; i++) {
    if (c[i] != 0)
      hp += c[i];
    else if (f[i] > 0 && hp < b[f[i]])
      hp = b[f[i]];
    if (hp < 0) break;
    p = i;
  }
  int q = r;
  hp = b[f[q]];
  for (int i = r - 1; i > l; i--) {
    if (c[i] != 0)
      hp += c[i];
    else if (f[i] > 0 && hp < b[f[i]])
      hp = b[f[i]];
    if (hp < 0) break;
    q = i;
  }
  if (q - p > 1)
    printf("-1\n");
  else {
    printf("%d\n", p);
    hp = b[f[l]];
    stk[0] = f[l];
    int top = 1;
    for (int i = l + 1; i <= p; i++) {
      if (c[i] != 0)
        hp += c[i];
      else if (f[i] > 0 && hp < b[f[i]]) {
        hp = b[f[i]];
        stk[top++] = f[i];
      }
    }
    while (top > 0) {
      int k = stk[--top];
      vis[k] = true;
      printf("%d ", k);
    }
    for (int i = l; i <= p; i++) {
      if (c[i] == 0 && f[i] > 0 && !vis[f[i]]) {
        vis[f[i]] = true;
        printf("%d ", f[i]);
      }
    }
    hp = b[f[r]];
    stk[0] = f[r];
    top = 1;
    for (int i = r - 1; i >= p + 1; i--) {
      if (c[i] != 0)
        hp += c[i];
      else if (f[i] > 0 && hp < b[f[i]]) {
        hp = b[f[i]];
        stk[top++] = f[i];
      }
    }
    while (top > 0) {
      int k = stk[--top];
      if (!vis[k]) {
        vis[k] = true;
        printf("%d ", k);
      }
    }
    for (int i = r; i >= p + 1; i--) {
      if (c[i] == 0 && f[i] > 0 && !vis[f[i]]) printf("%d ", f[i]);
    }
    printf("\n");
  }
  return 0;
}
