#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
template <class T>
inline void in(T &x) {
  x = 0;
  bool f = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + (c ^ '0'), c = getchar();
  if (f) x = -x;
}
int n, m;
int id[105], h[105];
int a[105];
int mx, mn;
bool vis[105];
vector<int> ans;
bool check(int x) {
  ans.clear();
  int cur = 0;
  for (register int i = mx; i > x; --i) {
    if (id[i]) {
      if (h[id[i]] > cur) ans.push_back(id[i]), cur = h[id[i]];
    }
    cur += a[i];
    if (cur < 0) return 0;
  }
  int rem = cur;
  cur = 0;
  for (register int i = mn; i < x; ++i) {
    if (id[i]) {
      if (h[id[i]] > cur) ans.push_back(id[i]), cur = h[id[i]];
    }
    cur += a[i];
    if (cur < 0) return 0;
  }
  if (rem + a[x] < 0 && cur + a[x] < 0) return 0;
  printf("%d\n", x);
  for (register int i = ans.size() - 1; i >= 0; --i)
    printf("%d ", ans[i]), vis[ans[i]] = 1;
  for (register int i = 1; i <= m; ++i)
    if (!vis[i]) printf("%d ", i);
  return 1;
}
signed main() {
  in(n), in(m);
  mx = 1, mn = n;
  for (register int i = 1, p; i <= m; ++i)
    in(p), id[p] = i, in(h[i]), mx = max(p, mx), mn = min(p, mn);
  for (register int i = 1; i <= n; ++i) in(a[i]);
  for (register int i = 1; i <= n; ++i)
    if (check(i)) return 0;
  puts("-1");
  return 0;
}
