#include <bits/stdc++.h>
using namespace std;
inline long long Rd() {
  long long x = 0;
  int ch = getchar(), f = 1;
  while (!isdigit(ch) && (ch != '-') && (ch != EOF)) ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void Rt(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10)
    Rt(x / 10), putchar(x % 10 + '0');
  else
    putchar(x + '0');
}
const int N = 200005;
int n, q, Id[N];
long long a[N], Bf[N];
int FindSML(long long x) {
  int l = 1, r = n;
  while (l < r) {
    int mid = l + r + 1 >> 1;
    if (a[mid] <= x)
      l = mid;
    else
      r = mid - 1;
  }
  return l;
}
int FindBIG(long long x) {
  int l = 1, r = n;
  while (l < r) {
    int mid = l + r >> 1;
    if (a[mid] < x)
      l = mid + 1;
    else
      r = mid;
  }
  return l;
}
int Solve(long long Len) {
  int Nw = 1, Dir = 0, Nd;
  while (1) {
    if (!Dir) {
      Nd = FindSML(a[Nw] + Len);
      if (Nd == Nw) return Nw;
      long long Qs = Len / (a[Nd] - a[Nw]);
      Len -= Qs * (a[Nd] - a[Nw]);
      if (Qs & 1) Nw = Nd, Dir = 1;
    } else {
      Nd = FindBIG(a[Nw] - Len);
      if (Nd == Nw) return Nw;
      long long Qs = Len / (a[Nw] - a[Nd]);
      Len -= Qs * (a[Nw] - a[Nd]);
      if (Qs & 1) Nw = Nd, Dir = 0;
    }
  }
}
bool cmp(int b, int c) { return a[b] < a[c]; }
int main() {
  n = Rd(), q = Rd();
  for (int i = 1; i <= (int)n; i++) a[i] = Bf[i] = Rd(), Id[i] = i;
  sort(Id + 1, Id + n + 1, cmp);
  for (int i = 1; i <= (int)n; i++) a[i] = Bf[Id[i]];
  for (int i = 1; i <= (int)q; i++)
    Rt(Id[Solve(Bf[Rd()] - a[1] + Rd())]), putchar('\n');
}
