#include <bits/stdc++.h>
using namespace std;
const int nm = 200002;
struct bg {
  int gt, vt;
};
int n, m;
bg a[nm];
int b[nm];
bool cmp(bg a, bg b) { return a.gt < b.gt; }
int find(int i, int l) {
  int le = i + 1, r = n, kq = i;
  while (le <= r) {
    int mid = (le + r) >> 1;
    if (a[mid].gt - a[i].gt <= l) {
      kq = mid;
      le = mid + 1;
    } else
      r = mid - 1;
  }
  return kq;
}
int find2(int i, int l) {
  int le = 1, r = i - 1, kq = i;
  while (le <= r) {
    int mid = (le + r) >> 1;
    if (a[i].gt - a[mid].gt <= l) {
      kq = mid;
      r = mid - 1;
    } else
      le = mid + 1;
  }
  return kq;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i].gt);
    a[i].vt = i;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; ++i) b[a[i].vt] = i;
  for (int i = 1; i <= m; ++i) {
    int u, l;
    scanf("%d%d", &u, &l);
    u = b[u];
    int dir = 0;
    do {
      int v, v2;
      if (!dir) {
        v = find(u, l);
        v2 = find2(v, l - abs(a[u].gt - a[v].gt));
      } else {
        v = find2(u, l);
        v2 = find(v, l - abs(a[u].gt - a[v].gt));
      }
      if (v == u && v2 == u) break;
      if (v2 == u) {
        int k = l / abs(a[u].gt - a[v].gt);
        l = l % abs(a[u].gt - a[v].gt);
        if (k & 1) {
          u = v;
          dir = 1 - dir;
        }
      } else {
        l -= abs(a[u].gt - a[v].gt);
        u = v;
        dir = 1 - dir;
      }
    } while (1);
    printf("%d\n", a[u].vt);
  }
}
