#include <bits/stdc++.h>
using namespace std;
int maze[105];
int Hero[105];
int n, h;
int Copy[105];
vector<int> ans;
void GoRight(int l, int r) {
  int tmp = Copy[l];
  for (int i = l; i <= r; i++) {
    if (Hero[i]) continue;
    tmp += Copy[i];
    if (tmp < 0) return;
  }
  for (int i = l; i <= r; i++) {
    if (Copy[i] == 0) continue;
    Copy[i] = 0;
    if (Hero[i]) ans.push_back(Hero[i]);
  }
}
void GoLeft(int r, int l) {
  int tmp = Copy[r];
  for (int i = r; i >= l; i--) {
    if (Hero[i]) continue;
    tmp += Copy[i];
    if (tmp < 0) return;
  }
  for (int i = r; i >= l; i--) {
    if (Copy[i] == 0) continue;
    Copy[i] = 0;
    if (Hero[i]) ans.push_back(Hero[i]);
  }
}
void Left(int pos) {
  for (int i = pos; i >= 1; i--) {
    if (Hero[i] && Copy[i]) GoRight(i, pos);
  }
}
void Right(int pos) {
  for (int i = pos; i <= n; i++)
    if (Copy[i] && Hero[i]) GoLeft(i, pos);
}
bool check(int pos) {
  ans.clear();
  for (int i = 0; i <= n; i++) Copy[i] = maze[i];
  for (int i = 0; i < 3; i++) {
    Left(pos);
    Right(pos);
  }
  return ans.size() == h;
}
int main() {
  int pos = 0;
  scanf("%d%d", &n, &h);
  memset(maze, 0, sizeof(maze));
  for (int i = 1; i <= h; i++) {
    int tmp;
    scanf("%d%d", &pos, &tmp);
    Hero[pos] = i;
    maze[pos] = tmp;
  }
  for (int i = 1; i <= n; i++) {
    int tmp;
    scanf("%d", &tmp);
    if (tmp != 0) maze[i] = tmp;
  }
  for (pos = 1; pos <= n; pos++)
    if (check(pos)) break;
  if (pos > n)
    printf("-1\n");
  else {
    printf("%d\n", pos);
    for (int i = 0; i < ans.size(); i++)
      printf("%d%c", ans[i], i + 1 == ans.size() ? '\n' : ' ');
  }
}
