#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int HP[m];
  int POS[m];
  for (int i = 0; i < m; i++) {
    cin >> POS[i] >> HP[i];
    POS[i]--;
  }
  int MAP[n];
  for (int i = 0; i < n; i++) {
    cin >> MAP[i];
  }
  for (int rally_point = 0; rally_point < n; rally_point++) {
    int map[n];
    int hp[m];
    memcpy(map, MAP, sizeof(MAP));
    memcpy(hp, HP, sizeof(HP));
    int turns[m];
    int turn_count = 0;
    while (turn_count < m) {
      for (int hero = 0; hero < m; hero++) {
        if (hp[hero] < 0) continue;
        int hero_hp = HP[hero];
        int hero_pos = POS[hero];
        while (true) {
          hero_hp += map[hero_pos];
          if (hero_hp < 0) {
            break;
          }
          int delta = rally_point - hero_pos;
          if (delta == 0) {
            hp[hero] = -1;
            for (int i = min(POS[hero], rally_point);
                 i <= max(POS[hero], rally_point); i++) {
              map[i] = 0;
            }
            turns[turn_count++] = hero + 1;
            goto ok;
          }
          if (delta > 0) {
            hero_pos++;
          } else {
            hero_pos--;
          }
        }
      }
      goto fail;
    ok:;
    }
    cout << rally_point + 1 << endl;
    for (int i = 0; i < m; i++) {
      cout << turns[i] << " ";
    }
    cout << endl;
    return 0;
  fail:;
  }
  cout << -1 << endl;
  return 0;
}
