#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 10;
int l[N], r[N], s[N], id[N], h[N], a[N];
bool print[N];
vector<int> ans;
int n;
void solve() {
  for (int i = 1; i <= n; ++i)
    if (id[i]) {
      int x = id[i], hp = h[x];
      for (int j = i; j <= n; ++j) {
        hp += a[j];
        if (hp < 0) break;
        r[x] = j;
      }
    }
  for (int i = n; i >= 1; --i)
    if (id[i]) {
      int x = id[i], hp = h[x];
      for (int j = i; j >= 1; --j) {
        hp += a[j];
        if (hp < 0) break;
        l[x] = j;
      }
    }
}
bool solve1(int i) {
  ans.clear();
  int last = 0, pre = i - 1;
  for (int j = i; j <= n; ++j)
    if (id[j]) {
      last = j;
      if (l[id[j]] <= pre) {
        pre = j;
        ans.push_back(id[j]);
      }
    }
  if (last && pre != last) {
    return 0;
  }
  if (last)
    pre = i - 1;
  else
    pre = i;
  last = 0;
  for (int j = i - 1; j >= 1; --j)
    if (id[j]) {
      last = j;
      if (r[id[j]] >= pre) {
        pre = j;
        ans.push_back(id[j]);
      }
    }
  if (last && pre != last) return 0;
  return 1;
}
bool solve2(int i) {
  ans.clear();
  int last = 0, pre = i;
  for (int j = i; j >= 1; --j)
    if (id[j]) {
      last = j;
      if (r[id[j]] >= pre) {
        pre = j;
        ans.push_back(id[j]);
      }
    }
  if (last && pre != last) {
    return 0;
  }
  if (last)
    pre = i + 1;
  else
    pre = i;
  last = 0;
  for (int j = i + 1; j <= n; ++j)
    if (id[j]) {
      last = j;
      if (l[id[j]] <= pre) {
        pre = j;
        ans.push_back(id[j]);
      }
    }
  if (last && pre != last) return 0;
  return 1;
}
int main() {
  int m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &s[i], &h[i]);
    id[s[i]] = i;
  }
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  solve();
  bool flag = 0;
  int i;
  for (i = 1; i <= n; ++i) {
    if (solve1(i)) {
      flag = 1;
      break;
    }
    if (solve2(i)) {
      flag = 1;
      break;
    }
  }
  if (!flag)
    puts("-1");
  else {
    printf("%d\n", i);
    for (int i = 0; i < ans.size(); ++i) {
      print[ans[i]] = 1, printf("%d", ans[i]);
      if (i != ans.size() - 1) putchar(' ');
    }
    for (int i = 1; i <= n; ++i)
      if (id[s[i]] && !print[id[s[i]]]) printf(" %d", id[s[i]]);
  }
  return 0;
}
