#include <bits/stdc++.h>
using namespace std;
vector<int> is_valid(const vector<int>& health, const vector<int>& start,
                     vector<int> val, int rally) {
  vector<bool> used(health.size(), false);
  vector<int> ans;
  while (ans.size() < used.size()) {
    bool found = false;
    for (int h = 0; h < health.size(); ++h)
      if (!used[h]) {
        int dir = start[h] >= rally ? -1 : 1;
        bool works = true;
        int hp = health[h];
        for (int at = start[h]; at != rally; at += dir) {
          hp += val[at];
          if (hp < 0) {
            works = false;
            break;
          }
        }
        hp += val[rally];
        if (hp < 0 || !works) {
          continue;
        }
        ans.push_back(h + 1);
        used[h] = true;
        found = true;
        for (int at = start[h]; at != rally + dir; at += dir) {
          val[at] = 0;
        }
        break;
      }
    if (!found) {
      return vector<int>(0);
    }
  }
  return ans;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int n, m;
  cin >> n >> m;
  vector<int> start(m), health(m), val(n);
  for (int i = 0; i < m; ++i) {
    cin >> start[i] >> health[i];
    start[i]--;
  }
  for (int i = 0; i < n; ++i) {
    cin >> val[i];
  }
  for (int rally = 0; rally < n; ++rally) {
    vector<int> ret = is_valid(health, start, val, rally);
    if (!ret.empty()) {
      cout << rally + 1 << '\n';
      for (int i = 0; i < ret.size(); ++i) {
        cout << ret[i] << (i + 1 == ret.size() ? '\n' : ' ');
      }
      return 0;
    }
  }
  cout << -1 << '\n';
}
