#include <bits/stdc++.h>
using namespace std;
void load() {}
const int N = 123;
int hp[N], a[N], r[N], n, m, pos[N], l[N];
vector<int> v;
bool vis[N];
bool check_l(int vt) {
  int p = vt;
  for (int i = 1; i <= n; ++i) vis[i] = 0;
  v.clear();
  bool ok = 0;
  int d = 0;
  for (int i = vt; i > 0; --i)
    if (hp[i]) {
      d = 1;
      if (r[i] <= p)
        ok = 1;
      else
        ok = 0, v.push_back(pos[i]), p = i, vis[i] = 1;
    }
  if (ok == 1) return 0;
  p = vt + d;
  for (int i = vt + 1; i <= n; ++i)
    if (hp[i]) {
      if (l[i] >= p)
        ok = 1;
      else
        ok = 0, v.push_back(pos[i]), p = i, vis[i] = 1;
    }
  for (int i = 1; i <= n; ++i)
    if (hp[i] && !vis[i]) v.push_back(pos[i]);
  return (ok == 0);
}
bool check_r(int vt) {
  int p = vt;
  for (int i = 1; i <= n; ++i) vis[i] = 0;
  v.clear();
  bool ok = 0;
  int d = 0;
  for (int i = vt; i <= n; ++i)
    if (hp[i]) {
      d = 1;
      if (l[i] >= p)
        ok = 1;
      else
        ok = 0, v.push_back(pos[i]), p = i, vis[i] = 1;
    }
  if (ok == 1) return 0;
  p = vt - d;
  for (int i = vt - 1; i > 0; --i)
    if (hp[i]) {
      if (r[i] <= p)
        ok = 1;
      else
        ok = 0, v.push_back(pos[i]), p = i, vis[i] = 1;
    }
  for (int i = 1; i <= n; ++i)
    if (hp[i] && !vis[i]) v.push_back(pos[i]);
  return (ok == 0);
}
void trungtt() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    int s, val;
    scanf("%d%d", &s, &val);
    hp[s] = val;
    pos[s] = i;
  }
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  a[n + 1] = -1e9;
  a[0] = -1e9;
  for (int i = 1; i <= n; ++i)
    if (hp[i]) {
      int res = hp[i];
      for (int j = i + 1; j <= n + 1; ++j) {
        res += a[j];
        if (res < 0) {
          r[i] = j;
          break;
        }
      }
      res = hp[i];
      for (int j = i - 1; j >= 0; --j) {
        res += a[j];
        if (res < 0) {
          l[i] = j;
          break;
        }
      }
    }
  for (int i = 1; i <= n; ++i)
    if (check_l(i) || check_r(i)) {
      printf("%d\n", i);
      for (int j : v) printf("%d ", j);
      return;
    }
  printf("-1");
}
int main() {
  load();
  trungtt();
  return 0;
}
