#include <bits/stdc++.h>
using namespace std;
const int MAX = 200;
int A[MAX];
int s[MAX], h[MAX];
int id[MAX];
int n, m;
int ans[MAX];
int inc(int p) {
  for (int i = 1; i <= p; i++)
    if (id[i]) return i;
  return -1;
}
int dec(int p) {
  for (int i = n; i >= p; i--)
    if (id[i]) return i;
  return -1;
}
bool left(int p) {
  memset(ans, 0, sizeof(ans));
  int pos = inc(p);
  int now = pos == -1 ? -1 : id[pos], sum = 0;
  int tot = 0;
  for (int i = 1; i <= p; i++)
    if (id[i]) tot++;
  if (now == -1) {
    if (A[p] < 0) return false;
  } else {
    ans[now] = 1;
    sum = h[now];
    int cnt = 1;
    for (int i = pos + 1; i <= p; i++) {
      if (id[i] != 0) {
        cnt++;
        if (h[id[i]] > sum) {
          for (int j = 1; j < i; j++) {
            if (id[j]) ans[id[j]]++;
          }
          now = id[i];
          sum = h[now];
          ans[now] = 1;
        } else
          ans[id[i]] = cnt;
      } else {
        if (A[i] < 0) {
          sum += A[i];
          if (sum < 0) return false;
        } else if (A[i] > 0) {
          sum += A[i];
        }
      }
    }
  }
  pos = dec(p + 1);
  now = pos == -1 ? -1 : id[pos], sum = 0;
  if (now == -1)
    return true;
  else {
    ans[now] = tot + 1;
    sum = h[now];
    int cnt = tot + 1;
    for (int i = pos - 1; i > p; i--) {
      if (id[i] != 0) {
        cnt++;
        if (h[id[i]] > sum) {
          for (int j = n; j > i; j--) {
            if (id[j]) ans[id[j]]++;
          }
          now = id[i];
          sum = h[now];
          ans[now] = tot + 1;
        } else
          ans[id[i]] = cnt;
      } else {
        if (A[i] < 0) {
          sum += A[i];
          if (sum < 0) return false;
        } else if (A[i] > 0) {
          sum += A[i];
        }
      }
    }
  }
  return true;
}
bool right(int p) {
  memset(ans, 0, sizeof(ans));
  int pos = dec(p);
  int now = pos == -1 ? -1 : id[pos], sum = 0;
  int tot = 0;
  for (int i = n; i >= p; i--)
    if (id[i]) tot++;
  if (now == -1) {
    if (A[p] < 0) return false;
  } else {
    ans[now] = 1;
    sum = h[now];
    int cnt = 1;
    for (int i = pos - 1; i >= p; i--) {
      if (id[i] != 0) {
        cnt++;
        if (h[id[i]] > sum) {
          for (int j = n; j > i; j--) {
            if (id[j]) ans[id[j]]++;
          }
          now = id[i];
          sum = h[now];
          ans[now] = 1;
        } else
          ans[id[i]] = cnt;
      } else {
        if (A[i] < 0) {
          sum += A[i];
          if (sum < 0) return false;
        } else if (A[i] > 0) {
          sum += A[i];
        }
      }
    }
  }
  pos = inc(p - 1);
  now = pos == -1 ? -1 : id[pos], sum = 0;
  if (now == -1)
    return true;
  else {
    ans[now] = tot + 1;
    sum = h[now];
    int cnt = tot + 1;
    for (int i = pos + 1; i < p; i++) {
      if (id[i] != 0) {
        cnt++;
        if (h[id[i]] > sum) {
          for (int j = 1; j < i; j++) {
            if (id[j]) ans[id[j]]++;
          }
          now = id[i];
          sum = h[now];
          ans[now] = tot + 1;
        } else
          ans[id[i]] = cnt;
      } else {
        if (A[i] < 0) {
          sum += A[i];
          if (sum < 0) return false;
        } else if (A[i] > 0) {
          sum += A[i];
        }
      }
    }
  }
  return true;
}
bool solve(int p) {
  if (left(p)) return true;
  if (right(p)) return true;
  return false;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", s + i, h + i);
    id[s[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", A + i);
  }
  for (int i = 1; i <= n; i++) {
    if (solve(i)) {
      printf("%d\n", i);
      vector<pair<int, int> > ttt;
      for (int j = 1; j <= m; j++) {
        ttt.push_back(make_pair(ans[j], j));
      }
      sort(ttt.begin(), ttt.end());
      for (auto x : ttt) {
        printf("%d ", x.second);
      }
      return 0;
    }
  }
  printf("-1");
}
