#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n, m, a[N], h[N], dd[N], id[N], fre[N];
bool cheq(int i, int s) {
  memset(fre, 0, sizeof(fre));
  if (i < s) {
    int H = h[i];
    for (int j = i + 1, _c = s; j <= _c; ++j)
      if (!h[j] && !dd[j]) {
        H += a[j];
        fre[j] = 1;
        if (H < 0) return 0;
      }
  } else {
    int H = h[i];
    for (int j = i - 1, _c = s; j >= _c; --j)
      if (!h[j] && !dd[j]) {
        H += a[j];
        fre[j] = 1;
        if (H < 0) return 0;
      }
  }
  for (int i = 1, _c = n; i <= _c; ++i)
    if (fre[i]) dd[i] = 1;
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1, _c = m; i <= _c; ++i) {
    int s, H;
    cin >> s >> H;
    h[s] = H;
    id[s] = i;
  }
  for (int i = 1, _c = n; i <= _c; ++i) cin >> a[i];
  for (int s = 1, _c = n; s <= _c; ++s) {
    vector<int> kq;
    memset(dd, 0, sizeof(dd));
    if (h[s]) kq.push_back(id[s]);
    while (1) {
      bool ok = 0;
      for (int i = 1, _c = s - 1; i <= _c; ++i)
        if (h[i] && !dd[i] && cheq(i, s)) {
          dd[i] = 1;
          ok = 1;
          kq.push_back(id[i]);
        }
      if (!ok) break;
    }
    bool O = 0;
    for (int i = 1, _c = s - 1; i <= _c; ++i)
      if (h[i] && !dd[i]) {
        O = 1;
        continue;
      }
    if (O) continue;
    while (1) {
      bool ok = 0;
      for (int i = s + 1, _c = n; i <= _c; ++i)
        if (h[i] && !dd[i] && cheq(i, s)) {
          dd[i] = 1;
          ok = 1;
          kq.push_back(id[i]);
        }
      if (!ok) break;
    }
    for (int i = s + 1, _c = n; i <= _c; ++i)
      if (h[i] && !dd[i]) {
        O = 1;
        continue;
      }
    if (O) continue;
    cout << s << "\n";
    for (auto& x : kq) cout << x << " ";
    return 0;
  }
  cout << -1;
}
