#include <bits/stdc++.h>
using namespace std;
int ni() {
  int v;
  scanf("%i", &v);
  return v;
}
int main() {
  auto n = ni();
  auto h = ni();
  struct Hero {
    int x;
    int h;
    int id;
  };
  vector<Hero> her(h);
  for (int i = 0; i < h; ++i) {
    her[i].x = ni() - 1;
    her[i].h = ni();
    her[i].id = i + 1;
  }
  vector<int> hd(n);
  for (int i = 0; i < n; ++i) hd[i] = ni();
  for (int pos = 0; pos < n; ++pos) {
    auto hers = her;
    vector<int> ans;
    for (int j = 0; j < hers.size(); ++j) {
      if (hers[j].x == pos) {
        ans.push_back(hers[j].id);
        hers.erase(hers.begin() + j);
        --j;
      }
    }
    auto f = hd;
    while (!hers.empty()) {
      int who = -1;
      int d = -1;
      for (int i = 0; i < hers.size(); ++i) {
        auto hpos = hers[i].x;
        auto step = hpos < pos ? +1 : -1;
        auto health = hers[i].h;
        auto steps = 0;
        while (health >= 0) {
          health += f[hpos];
          if (hpos == pos) break;
          hpos += step;
          ++steps;
        }
        if (hpos == pos && health >= 0) {
          if (steps > d) {
            who = i;
            d = steps;
          }
        }
      }
      if (who < 0) break;
      auto hpos = hers[who].x;
      auto step = hpos < pos ? +1 : -1;
      auto health = hers[who].h;
      auto steps = 0;
      while (health >= 0) {
        health += f[hpos];
        f[hpos] = 0;
        if (hpos == pos) break;
        hpos += step;
        ++steps;
      }
      ans.push_back(hers[who].id);
      hers.erase(hers.begin() + who);
    }
    if (hers.empty()) {
      cout << pos + 1 << endl;
      for (auto v : ans) cout << v << " ";
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
