#include <bits/stdc++.h>
using namespace std;
struct hero {
  int power;
  int nr;
};
int main() {
  int n, m;
  int board[100];
  hero heroes[100];
  vector<int> left, right;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) heroes[i].nr = -1;
  int l_ind = n;
  int r_ind = -1;
  for (int si, hi, i = 0; i < m; ++i) {
    cin >> si >> hi;
    heroes[si - 1].nr = i + 1;
    heroes[si - 1].power = hi;
    if (si - 1 < l_ind) l_ind = si - 1;
    if (si - 1 > r_ind) r_ind = si - 1;
  }
  for (int i = 0; i < n; ++i) cin >> board[i];
  int cur_pow = heroes[l_ind].power;
  int cur_hero = heroes[l_ind].nr;
  if (m == 1) {
    cout << l_ind + 1 << "\n1" << endl;
    return 0;
  }
  while (l_ind < n - 1 && l_ind + 1 < r_ind) {
    if (board[l_ind + 1] >= 0) {
      cur_pow += board[l_ind + 1];
      if (heroes[l_ind + 1].nr != -1) {
        if (heroes[l_ind + 1].power > cur_pow) {
          left.push_back(cur_hero);
          cur_hero = heroes[l_ind + 1].nr;
          cur_pow = heroes[l_ind + 1].power;
        } else {
          left.push_back(heroes[l_ind + 1].nr);
        }
      }
    } else {
      if (cur_pow + board[l_ind + 1] >= 0)
        cur_pow += board[l_ind + 1];
      else {
        break;
      }
    }
    ++l_ind;
  }
  left.push_back(cur_hero);
  cur_hero = heroes[r_ind].nr;
  cur_pow = heroes[r_ind].power;
  while (r_ind > 0 && l_ind < r_ind - 1) {
    if (board[r_ind - 1] >= 0) {
      cur_pow += board[r_ind - 1];
      if (heroes[r_ind - 1].nr != -1) {
        if (heroes[r_ind - 1].power > cur_pow) {
          right.push_back(cur_hero);
          cur_hero = heroes[r_ind - 1].nr;
          cur_pow = heroes[r_ind - 1].power;
        } else {
          right.push_back(heroes[r_ind - 1].nr);
        }
      }
    } else {
      if (cur_pow + board[r_ind - 1] >= 0)
        cur_pow += board[r_ind - 1];
      else {
        break;
      }
    }
    --r_ind;
  }
  right.push_back(cur_hero);
  if (abs(l_ind - r_ind) > 1)
    cout << "-1" << endl;
  else {
    cout << l_ind + 1 << endl;
    for (auto it = left.end() - 1; it >= left.begin(); --it)
      cout << (*it) << " ";
    for (auto it = right.end() - 1; it >= right.begin(); --it)
      cout << (*it) << " ";
    cout << endl;
  }
  return 0;
}
