#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& s, vector<T> v) {
  for (auto x : v) {
    s << x;
  }
  s << endl;
  return s;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& s, pair<T1, T2> v) {
  s << "\t" << v.first << " " << v.second << endl;
  return s;
}
template <typename T>
ostream& operator<<(ostream& s, set<T> v) {
  for (auto x : v) {
    s << x;
  }
  s << endl;
  return s;
}
const int MAX = 141;
int n, m;
int a[MAX];
int hrs[MAX];
int x0[MAX];
int hp0[MAX];
deque<int> q1, q2;
void solve() {
  int r = n + 1;
  int l = 0;
  {
    int curv = -1;
    bool f = false;
    for (int i = 1; i <= n; i++) {
      if (!f) {
        if (hrs[i] == 0) continue;
        f = true;
      }
      if (hrs[i] != 0) {
        if (curv < hp0[hrs[i]]) {
          curv = hp0[hrs[i]];
          q1.push_front(hrs[i]);
        } else {
          q1.push_back(hrs[i]);
        }
      }
      curv += a[i];
      if (curv < 0) {
        r = i;
        break;
      }
    }
  }
  {
    int curv = -1;
    bool f = false;
    for (int i = n; i >= 1; i--) {
      if (!f) {
        if (hrs[i] == 0) continue;
        f = true;
      }
      if (hrs[i] != 0) {
        if (curv < hp0[hrs[i]]) {
          curv = hp0[hrs[i]];
          q2.push_front(hrs[i]);
        } else {
          q2.push_back(hrs[i]);
        }
      }
      curv += a[i];
      if (curv < 0) {
        l = i;
        break;
      }
    }
  }
  int h1 = 1000 * 1000;
  for (int i = 1; i <= m; i++) {
    h1 = min(h1, x0[i]);
  }
  if (l >= r) {
    printf("-1\n");
  } else {
    int ans = max(l, 1);
    if (h1 > ans) {
      ans++;
    }
    vector<int> ser;
    for (auto z : q1) {
      if (x0[z] <= ans) {
        ser.push_back(z);
      }
    }
    for (auto z : q2) {
      if (x0[z] > ans) {
        ser.push_back(z);
      }
    }
    printf("%d\n", ans);
    for (auto z : ser) {
      printf("%d ", z);
    }
    printf("\n");
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &x0[i], &hp0[i]);
    hrs[x0[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  solve();
  return 0;
}
