#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = 1e-9;
const int OO = 1 * 1e9;
const int N = (1 << 17);
int a[105], e[105], h[105];
int dis[105][105][2];
int n, m, t;
vector<int> valid(int s) {
  vector<int> ans;
  queue<int> sk;
  int c = s;
  for (int i = s; i > 0; i--) {
    if (e[i]) {
      if (h[e[i]] >= dis[i][c][0]) {
        ans.push_back(e[i]);
        c = i - 1;
        while (!sk.empty()) {
          ans.push_back(sk.front());
          sk.pop();
        }
      } else {
        sk.push(e[i]);
      }
    }
  }
  if (sk.empty()) return ans;
  vector<int> em;
  em.push_back(0);
  return em;
}
vector<int> validc(int s) {
  vector<int> ans;
  queue<int> sk;
  int c = s;
  for (int i = s; i <= n; i++) {
    if (e[i]) {
      if (h[e[i]] >= dis[c][i][1]) {
        ans.push_back(e[i]);
        c = i + 1;
        while (!sk.empty()) {
          ans.push_back(sk.front());
          sk.pop();
        }
      } else {
        sk.push(e[i]);
      }
    }
  }
  if (sk.empty()) return ans;
  vector<int> em;
  em.push_back(0);
  return em;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> t >> h[i];
    e[t] = i;
  }
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) {
      int c = 0, mx = 0;
      for (int h = i; h <= j; h++) {
        c -= a[h];
        mx = max(mx, c);
      }
      dis[i][j][0] = mx;
    }
  for (int i = 1; i <= n; i++)
    for (int j = i; j > 0; j--) {
      int c = 0, mx = 0;
      for (int h = i; h >= j; h--) {
        c -= a[h];
        mx = max(mx, c);
      }
      dis[j][i][1] = mx;
    }
  for (int s = 1; s <= n; s++) {
    vector<int> l = valid(s - 1);
    vector<int> ls = valid(s);
    vector<int> r = validc(s + 1);
    vector<int> rs = validc(s);
    if ((l.empty() || l[0]) && (!rs.empty() && rs[0])) {
      cout << s << "\n";
      for (auto it : rs) cout << it << " ";
      for (auto it : l) cout << it << " ";
      return 0;
    }
    if ((!ls.empty() && ls[0]) && (r.empty() || r[0])) {
      cout << s << "\n";
      for (auto it : ls) cout << it << " ";
      for (auto it : r) cout << it << " ";
      return 0;
    }
  }
  cout << -1;
  return 0;
}
