#include <bits/stdc++.h>
using namespace std;
const int nmax = 111;
int n, m;
int ll[nmax], rr[nmax];
int id[nmax], p[nmax];
int vis[nmax], tt[nmax];
vector<pair<int, int> > hero;
vector<int> ans;
void init() {
  for (int i = 0; i < m; i++) {
    int st = hero[i].first, tot = hero[i].second;
    while (st <= n && tot + p[st] >= 0) {
      tot += p[st];
      rr[hero[i].first] = st;
      st++;
    }
    st = hero[i].first, tot = hero[i].second;
    while (st >= 1 && tot + p[st] >= 0) {
      tot += p[st];
      ll[hero[i].first] = st;
      st--;
    }
  }
}
bool judge_left(int ed) {
  int i, e1 = ed, c = 0;
  if (vis[ed]) e1 = ed - 1 > 0 ? ed - 1 : ed;
  for (i = 1; i <= e1; i++) {
    if (!id[i]) continue;
    if (vis[i]) continue;
    if (rr[i] >= e1) {
      int nex = i;
      while (i <= e1) {
        if (!vis[i]) {
          vis[i] = 1;
          if (id[i]) {
            ans.push_back(id[i]);
          }
        }
        i++;
      }
      return judge_left(nex);
    } else
      c++;
  }
  if (c) return false;
  return true;
}
bool judge_right(int ed) {
  int i, e2 = ed, c = 0;
  if (vis[ed]) e2 = ed + 1 <= n ? ed + 1 : ed;
  for (i = n; i >= e2; i--) {
    if (!id[i]) continue;
    if (vis[i]) continue;
    if (ll[i] <= e2) {
      int nex = i;
      while (i >= e2) {
        if (!vis[i]) {
          vis[i] = 1;
          if (id[i]) {
            ans.push_back(id[i]);
          }
        }
        i--;
      }
      return judge_right(nex);
    } else
      c++;
  }
  if (c) return false;
  return true;
}
int main() {
  int pos, ini;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &pos, &ini);
    id[pos] = i + 1;
    hero.push_back(make_pair(pos, ini));
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
  }
  init();
  int ed = -1;
  for (int i = 1; i <= n; i++) {
    memset(vis, 0, sizeof(vis));
    ans.clear();
    if (judge_left(i) && judge_right(i)) {
      ed = i;
      break;
    }
    memset(vis, 0, sizeof(vis));
    ans.clear();
    if (judge_right(i) && judge_left(i)) {
      ed = i;
      break;
    }
  }
  if (ed > 0) {
    cout << ed << endl;
    for (int i = 0; i < ans.size(); i++) {
      printf("%d ", ans[i]);
    }
    printf("\n");
  } else
    cout << -1 << endl;
  return 0;
}
