#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
int A[MAXN];
int pos[MAXN];
int hp[MAXN];
int ishero[MAXN];
int is[MAXN];
int B[MAXN];
int main() {
  int N, H;
  scanf("%d%d", &N, &H);
  for (int i = 1; i <= H; i++) {
    scanf("%d%d", &pos[i], &hp[i]);
    ishero[pos[i]] = i;
  }
  for (int i = 1; i <= N; i++) {
    scanf("%d", &A[i]);
    B[i] = A[i];
    is[i] = ishero[i];
  }
  for (int h = 1; h <= N; h++) {
    vector<int> ans;
    for (int i = 1; i <= N; i++) {
      A[i] = B[i];
      ishero[i] = is[i];
    }
    bool flag = 0;
    for (int j = h; j >= 1; j--) {
      if (ishero[j]) {
        flag = false;
        int sum = hp[ishero[j]];
        for (int k = j; k <= h; k++) {
          sum += A[k];
          if (sum < 0) {
            break;
          }
        }
        if (sum >= 0) {
          flag = true;
          for (int k = j; k <= h; k++) {
            A[k] = 0;
            if (ishero[k]) {
              ans.push_back(ishero[k]);
              ishero[k] = 0;
            }
          }
        }
      }
    }
    if (flag) {
      for (int j = h + 1; j <= N; j++) {
        if (ishero[j]) {
          flag = false;
          int sum = hp[ishero[j]];
          for (int k = j; k >= h; k--) {
            sum += A[k];
            if (sum < 0) {
              break;
            }
          }
          if (sum >= 0) {
            flag = true;
            for (int k = j; k > h; k--) {
              A[k] = 0;
              if (ishero[k]) {
                ans.push_back(ishero[k]);
                ishero[k] = 0;
              }
            }
          }
        }
      }
    }
    if (ans.size() == H) {
      cout << h << endl;
      for (int i = 0; i < ans.size(); i++) {
        cout << ans[i] << " ";
      }
      cout << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
