#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * asin(1);
enum cellType {
  Empty,
  Hero,
  Monster,
  Potion,
};
struct cell {
  int value;
  int heroIndex;
  cellType ty;
};
int n;
cell originalCells[100];
cell cells[100];
int walkOrder[100];
int walkCount = 0;
void addWalk(int hero) { walkOrder[walkCount++] = hero; }
bool rally(int pt, int dir, int end) {
  while (true) {
    int currentCost = 0;
    bool foundAny = false;
    bool foundPossible = false;
    for (int i = pt; i != end; i += dir) {
      if (cells[i].ty == Empty)
        continue;
      else if (cells[i].ty == Potion) {
        currentCost = max(0, currentCost - cells[i].value);
        continue;
      } else if (cells[i].ty == Hero) {
        foundAny = true;
        if (cells[i].value >= currentCost) {
          foundPossible = true;
          addWalk(cells[i].heroIndex);
          for (int j = pt; j != i + dir; j += dir) {
            if (cells[j].ty != Hero) {
              cells[j].ty = Empty;
              cells[j].value = 0;
            }
          }
          cells[i].ty = Empty;
          cells[i].value = 0;
          break;
        }
      } else if (cells[i].ty == Monster) {
        currentCost = currentCost + cells[i].value;
      } else {
        cout << "bad cell" << endl;
        exit(1);
      }
    }
    if (foundPossible) continue;
    if (foundAny) return false;
    return true;
  }
  return true;
}
int submission_main() {
  int m;
  cin >> n >> m;
  for (int i = 0; i < (m); i++) {
    int pos, hp;
    cin >> pos >> hp;
    cells[pos - 1].ty = Hero;
    cells[pos - 1].value = hp;
    cells[pos - 1].heroIndex = i + 1;
  }
  for (int i = 0; i < (n); i++) {
    if (cells[i].ty == Hero) {
      int x;
      cin >> x;
      continue;
    }
    cin >> cells[i].value;
    if (cells[i].value == 0) {
      cells[i].ty = Empty;
    } else if (cells[i].value < 0) {
      cells[i].value *= -1;
      cells[i].ty = Monster;
    } else {
      cells[i].ty = Potion;
    }
  }
  for (int i = 0; i < (n); i++) originalCells[i] = cells[i];
  for (int i = 0; i < (n); i++) {
    walkCount = 0;
    for (int j = 0; j < (n); j++) {
      cells[j] = originalCells[j];
    }
    if (rally(i, 1, n) && rally(i, -1, -1)) {
      cout << i + 1 << endl;
      for (int k = 0; k < (m); k++) cout << walkOrder[k] << " ";
      return 0;
    }
    walkCount = 0;
    for (int j = 0; j < (n); j++) {
      cells[j] = originalCells[j];
    }
    if (rally(i, -1, -1) && rally(i, 1, n)) {
      cout << i + 1 << endl;
      for (int k = 0; k < (m); k++) cout << walkOrder[k] << " ";
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
int local_main() { return submission_main(); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  return submission_main();
}
