#include <bits/stdc++.h>
using namespace std;
int s[105], h[105], n, m;
int a[105];
int b[105];
bool vis[105], vis1[105];
bool check(vector<int> vec, int i) {
  memset(vis1, false, sizeof(vis1));
  for (auto it : vec) {
    int sum = h[it];
    if (s[it] < i) {
      for (int j = s[it]; j <= i; j++) {
        if (!vis1[j]) {
          sum += a[j];
          if (sum < 0) return false;
          vis1[j] = true;
        }
      }
    } else if (s[it] > i) {
      for (int j = s[it]; j >= i; j--) {
        if (!vis1[j]) {
          sum += a[j];
          if (sum < 0) return false;
          vis1[j] = true;
        }
      }
    }
  }
  return true;
}
bool solve(int i) {
  vector<int> vec;
  memset(vis, false, sizeof(vis));
  int sum = 0;
  for (int j = i; j >= 1; j--) {
    sum += a[j];
    sum = min(sum, 0);
    if (b[j]) {
      if (h[b[j]] + sum >= 0) {
        sum = 0;
        vec.push_back(b[j]);
        vis[b[j]] = true;
      }
    }
  }
  sum = 0;
  for (int j = i + 1; j <= n; j++) {
    sum += a[j];
    sum = min(sum, 0);
    if (b[j]) {
      if (h[b[j]] + sum >= 0) {
        sum = 0;
        vec.push_back(b[j]);
        vis[b[j]] = true;
      }
    }
  }
  for (int j = 1; j <= m; j++)
    if (!vis[j]) vec.push_back(j);
  if (check(vec, i)) {
    printf("%d\n", i);
    for (auto it : vec) printf("%d ", it);
    return true;
  }
  vec.clear();
  memset(vis, false, sizeof(vis));
  sum = 0;
  for (int j = i; j <= n; j++) {
    sum += a[j];
    sum = min(sum, 0);
    if (b[j]) {
      if (h[b[j]] + sum >= 0) {
        sum = 0;
        vec.push_back(b[j]);
        vis[b[j]] = true;
      }
    }
  }
  sum = 0;
  for (int j = i - 1; j >= 1; j--) {
    sum += a[j];
    sum = min(sum, 0);
    if (b[j]) {
      if (h[b[j]] + sum >= 0) {
        sum = 0;
        vec.push_back(b[j]);
        vis[b[j]] = true;
      }
    }
  }
  for (int j = 1; j <= m; j++)
    if (!vis[j]) vec.push_back(j);
  if (check(vec, i)) {
    printf("%d\n", i);
    for (auto it : vec) printf("%d ", it);
    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]);
    b[s[i]] = i;
  }
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++)
    if (solve(i)) return 0;
  puts("-1");
  return 0;
}
