#include <bits/stdc++.h>
const int MAXN = 100 + 10;
int n, m;
int pos[MAXN];
int h[MAXN];
int a[MAXN];
std::vector<int> seq;
bool solve(int x) {
  int last = x;
  seq.clear();
  std::vector<int> f, b;
  bool fin = 1;
  for (int i = x; i >= 1; i--) {
    if (pos[i]) {
      int cur = h[pos[i]];
      bool flag = 1;
      for (int j = i; j <= last; j++) {
        cur += a[j];
        if (cur < 0) {
          flag = 0;
          break;
        }
      }
      if (flag) {
        last = i - 1;
        f.push_back(pos[i]);
        fin = 1;
      } else {
        b.push_back(pos[i]);
        fin = 0;
      }
    }
  }
  if (!fin) return 0;
  seq.insert(seq.end(), f.begin(), f.end());
  seq.insert(seq.end(), b.begin(), b.end());
  f.clear();
  b.clear();
  last = seq.empty() ? x : x + 1;
  fin = 1;
  for (int i = x + 1; i <= n; i++) {
    if (pos[i]) {
      int cur = h[pos[i]];
      bool flag = 1;
      for (int j = i; j >= last; j--) {
        cur += a[j];
        if (cur < 0) {
          flag = 0;
          break;
        }
      }
      if (flag) {
        last = i + 1;
        f.push_back(pos[i]);
        fin = 1;
      } else {
        b.push_back(pos[i]);
        fin = 0;
      }
    }
  }
  if (!fin) return 0;
  seq.insert(seq.end(), f.begin(), f.end());
  seq.insert(seq.end(), b.begin(), b.end());
  return 1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int s;
    scanf("%d%d", &s, h + i);
    pos[s] = i;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
  }
  for (int i = 1; i <= n; i++) {
    if (solve(i)) {
      printf("%d\n", i);
      for (int j : seq) {
        printf("%d ", j);
      }
      printf("\n");
      return 0;
    }
  }
  std::reverse(pos + 1, pos + n + 1);
  std::reverse(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    if (solve(i)) {
      printf("%d\n", n + 1 - i);
      for (int j : seq) {
        printf("%d ", j);
      }
      printf("\n");
      return 0;
    }
  }
  puts("-1");
}
