#include <bits/stdc++.h>
using namespace std;
int n, m;
int iid[500060];
struct node {
  int w, id;
} a[500060];
bool cmp(node x, node y) { return x.w < y.w; }
int find(int x, int &len, int &fl) {
  if (fl == 1) {
    int l = x, r = n, mid;
    while (l < r) {
      mid = (l + r + 1) >> 1;
      if (a[mid].w - a[x].w <= len)
        l = mid;
      else
        r = mid - 1;
    }
    len -= a[l].w - a[x].w;
    fl ^= 1;
    return l;
  } else {
    int l = 1, r = x, mid;
    while (l < r) {
      mid = (l + r) >> 1;
      if (a[x].w - a[mid].w > len)
        l = mid + 1;
      else
        r = mid;
    }
    len -= a[x].w - a[l].w;
    fl ^= 1;
    return l;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i].w);
    a[i].id = i;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; ++i) iid[a[i].id] = i;
  while (m--) {
    int x, len;
    scanf("%d%d", &x, &len);
    x = iid[x];
    int nw = x, ls = 0, fl = 1;
    int L = find(nw, len, fl);
    ls = nw;
    nw = L;
    while ((L = find(nw, len, fl)) && L != nw) {
      if (ls == L) {
        int dl = abs(a[L].w - a[nw].w);
        if (((len / dl) & 1) == 0)
          ls = nw, nw = L;
        else
          fl ^= 1;
        len %= dl;
      } else {
        ls = nw, nw = L;
      }
    }
    printf("%d\n", a[nw].id);
  }
}
