#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int MAXN = 1e6 + 10;
const long long MOD = 1e9 + 7;
const long long MOD2 = 998244353;
const long long INF = 8e18;
const int LOG = 20;
long long pw(long long a, long long b, long long mod) {
  return (!b ? 1
             : (b & 1 ? (a * pw(a * a % mod, b / 2, mod)) % mod
                      : pw(a * a % mod, b / 2, mod)));
}
int X[MAXN], H[MAXN], v[MAXN], mark[MAXN], n, m;
vector<int> _, moves;
bool comp(int i, int j) { return X[i] < X[j]; }
bool CanR(int id, int place) {
  int init = H[id], x = X[id];
  for (int i = x; i <= place; i++) {
    init += v[i];
    if (init < 0) return 0;
  }
  return 1;
}
bool CanL(int id, int place) {
  int init = H[id], x = X[id];
  for (int i = x; i >= place; i--) {
    init += v[i];
    if (init < 0) return 0;
  }
  return 1;
}
bool check(int x) {
  moves.clear();
  for (int i = 1; i <= m; i++) {
    mark[i] = 0;
  }
  vector<int> L, R;
  for (auto cu : _) {
    if (X[cu] <= x) {
      L.push_back(cu);
    } else {
      R.push_back(cu);
    }
  }
  reverse((L).begin(), (L).end());
  int last = x, f1 = 1, f2 = 1;
  for (auto cu : L) {
    f1 = CanR(cu, last);
    if (f1) {
      moves.push_back(cu);
      mark[cu] = 1;
      last = X[cu] - 1;
    }
  }
  if (!L.empty())
    last = x + 1;
  else {
    last = x;
  }
  for (auto cu : R) {
    f2 = CanL(cu, last);
    if (f2) {
      moves.push_back(cu);
      mark[cu] = 1;
      last = X[cu] + 1;
    }
  }
  if (f1 && f2) {
    for (int i = 1; i <= m; i++) {
      if (mark[i] == 0) {
        moves.push_back(i);
      }
    }
    return 1;
  }
  moves.clear();
  for (int i = 1; i <= m; i++) {
    mark[i] = 0;
  }
  if (!R.empty())
    last = x + 1;
  else {
    last = x;
  }
  f1 = 1, f2 = 1;
  for (auto cu : L) {
    f1 = CanR(cu, last);
    if (f1) {
      moves.push_back(cu);
      mark[cu] = 1;
      last = X[cu] - 1;
    }
  }
  last = x;
  for (auto cu : R) {
    f2 = CanL(cu, last);
    if (f2) {
      moves.push_back(cu);
      mark[cu] = 1;
      last = X[cu] + 1;
    }
  }
  if (f1 && f2) {
    for (int i = 1; i <= m; i++) {
      if (mark[i] == 0) {
        moves.push_back(i);
      }
    }
    return 1;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> X[i] >> H[i];
    _.push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
  }
  sort((_).begin(), (_).end(), comp);
  for (int i = 1; i <= n; i++) {
    if (check(i)) {
      cout << i << "\n";
      for (auto x : moves) {
        cout << x << " ";
      }
      return 0;
    }
  }
  cout << -1, 0;
  return 0;
}
