#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 10;
int n, m;
int a[N], hero[N], hero_rv[N], fL[N], fR[N], minL[N][N], minR[N][N],
    idx_hero[N], idx_hero_rv[N];
vector<int> ansL, ansR;
void TraceLeft(int center, int l, int *hero) {
  if (l == center + 1) return;
  ansL.push_back(l);
  for (int r = l; r <= center; ++r) {
    if (hero[l] >= -minL[l][r] && fL[r + 1]) {
      TraceLeft(center, r + 1, hero);
      return;
    }
  }
  assert(false);
}
void TraceRight(int center, int r, int *hero) {
  if (r == center) return;
  ansR.push_back(r);
  for (int l = r; l >= center + 1; --l)
    if (hero[r] >= -minR[r][l] && fR[l - 1]) {
      TraceRight(center, l - 1, hero);
      return;
    }
  assert(false);
}
bool fre[N];
void Trace(int l, int r, int center, bool rv, int *hero, int *idx_hero) {
  if (l >= 1) {
    TraceLeft(center, l, hero);
    reverse(ansL.begin(), ansL.end());
    for (int v : ansL) fre[v] = true;
    for (int i = 1; i <= center; ++i)
      if (hero[i] != 0 && fre[i] == false) ansL.push_back(i);
  }
  if (r <= n) {
    TraceRight(center, r, hero);
    reverse(ansR.begin(), ansR.end());
    for (int v : ansR) fre[v] = true;
    for (int i = center + 1; i <= n; ++i)
      if (hero[i] != 0 && fre[i] == false) ansR.push_back(i);
  }
  for (int v : ansL) cout << idx_hero[v] << " ";
  for (int v : ansR) cout << idx_hero[v] << " ";
}
void Solve(bool rv, int *hero, int *idx_hero) {
  if (rv) {
    reverse(a + 1, a + n + 1);
  }
  int idx = -1;
  for (int i = 1; i <= n; ++i)
    if (hero[i] != 0) {
      idx = i;
      break;
    }
  for (int center = idx; center <= n; ++center) {
    memset(minL, 0, sizeof minL);
    memset(minR, 0, sizeof minR);
    for (int i = 1; i <= center; ++i) {
      int val = 0, min_val = 0;
      for (int j = i; j <= center; ++j) {
        val += a[j];
        min_val = min(min_val, val);
        minL[i][j] = min_val;
      }
    }
    for (int i = center + 1; i <= n; ++i) {
      int val = 0, min_val = 0;
      for (int j = i; j >= center + 1; --j) {
        val += a[j];
        min_val = min(min_val, val);
        minR[i][j] = min_val;
      }
    }
    memset(fL, 0, sizeof fL);
    fL[center + 1] = true;
    memset(fR, 0, sizeof fR);
    fR[center] = true;
    for (int i = center; i >= 1; --i)
      if (hero[i] != 0) {
        for (int j = i; j <= center; ++j)
          if (hero[i] >= -minL[i][j]) {
            fL[i] = fL[i] | fL[j + 1];
          }
      }
    for (int i = center + 1; i <= n; ++i)
      if (hero[i] != 0) {
        for (int j = i; j >= center + 1; --j)
          if (hero[i] >= -minR[i][j]) fR[i] = fR[i] | fR[j - 1];
      }
    int idx_left_hero = 0, idx_right_hero = n + 1;
    for (int i = 1; i <= center; ++i)
      if (hero[i] != 0) {
        idx_left_hero = i;
        break;
      }
    for (int i = n; i >= center + 1; --i)
      if (hero[i] != 0) {
        idx_right_hero = i;
        break;
      }
    fL[0] = fR[n + 1] = true;
    if (fL[idx_left_hero] && fR[idx_right_hero]) {
      cout << (rv ? n - center + 1 : center) << '\n';
      Trace(idx_left_hero, idx_right_hero, center, rv, hero, idx_hero);
      exit(0);
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    int s, h;
    cin >> s >> h;
    hero[s] = h;
    hero_rv[n - s + 1] = h;
    idx_hero[s] = i;
    idx_hero_rv[n - s + 1] = i;
  }
  for (int i = 1; i <= n; ++i) cin >> a[i];
  Solve(false, hero, idx_hero);
  Solve(true, hero_rv, idx_hero_rv);
  cout << "-1";
  return 0;
}
