#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const double eps = 1e-8;
const int maxN = 2e5 + 10;
const int maxL = 45;
const long long inf = 1e18;
int n, m, f[maxN];
pair<int, int> P[maxN];
int R(int x, int tol, bool mark);
int L(int x, int tol, bool mark) {
  int k = lower_bound(P, P + n, pair<int, int>(P[x].first - tol, 0)) - P;
  if (k == x) {
    if (!mark) return k;
    return R(k, tol, 1);
  }
  tol -= P[x].first - P[k].first;
  tol %= (P[x].first - P[k].first) * 2;
  return R(k, tol, 1);
}
int R(int x, int tol, bool mark) {
  int k = lower_bound(P, P + n, pair<int, int>(tol + P[x].first + 1, 0)) - P;
  k--;
  if (k == x) return L(x, tol, 0);
  tol -= P[k].first - P[x].first;
  if (mark) tol %= (P[k].first - P[x].first) * 2;
  return L(k, tol, 1);
}
inline void init() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &P[i].first);
    P[i].second = i;
  }
  sort(P, P + n);
  for (int i = 0; i < n; i++) {
    f[P[i].second] = i;
  }
}
inline void solve() {
  int a, b;
  while (m--) {
    scanf("%d%d", &a, &b);
    a = f[a - 1];
    printf("%d\n", P[R(a, b, 0)].second + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  init();
  solve();
  return 0;
}
