#include <bits/stdc++.h>
using namespace std;
int decrease_r(const int le, const int ri, int newlen,
               vector<pair<int, int>>& a) {
  int l = le;
  int r = ri + 1;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (a[m].first - a[le].first > newlen)
      r = m;
    else
      l = m;
  }
  return l;
}
int increase_l(const int le, const int ri, int newlen,
               vector<pair<int, int>>& a) {
  int l = le - 1;
  int r = ri;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (a[ri].first - a[m].first > newlen)
      l = m;
    else
      r = m;
  }
  return r;
}
int solve_query(int len, int l, vector<pair<int, int>>& a) {
  bool isl = true;
  int r = decrease_r(l, a.size() - 1, len, a);
  len -= a[r].first - a[l].first;
  isl = false;
  l = increase_l(0, r, len, a);
  len -= a[r].first - a[l].first;
  isl = true;
  while (r != l) {
    int nxtlen = len % (a[r].first - a[l].first);
    int cnt = len / (a[r].first - a[l].first);
    bool nxtisl = (cnt & 1) ^ isl;
    int nxtl = l;
    int nxtr = r;
    if (nxtisl)
      nxtr = decrease_r(l, r, nxtlen, a);
    else
      nxtl = increase_l(l, r, nxtlen, a);
    len = nxtlen;
    isl = nxtisl;
    l = nxtl;
    r = nxtr;
  }
  return a[l].second;
}
vector<int> solve(vector<int> x, vector<pair<int, int>> q) {
  int n = x.size();
  int m = q.size();
  vector<pair<int, int>> a;
  map<int, int> o;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    a[i] = {x[i], i};
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < a.size(); i++) o[a[i].second] = i;
  vector<int> res;
  for (int i = 0; i < m; i++) {
    int l = q[i].first;
    int len = q[i].second;
    l--;
    res.push_back(solve_query(len, o[l], a) + 1);
  }
  return res;
}
vector<int> solve_slow(vector<int> x, vector<pair<int, int>> q) {
  int n = x.size();
  int m = q.size();
  vector<int> res;
  for (int i = 0; i < m; i++) {
    int pos = q[i].first;
    pos--;
    int len = q[i].second;
    bool isl = true;
    int no_change = 0;
    while (no_change < 5) {
      int max_index = -1;
      for (int i = 0; i < x.size(); i++) {
        if (i == pos) continue;
        int cur = x[i];
        if (isl == (x[pos] > cur)) continue;
        if (abs(cur - x[pos]) > len) continue;
        if (max_index == -1 || abs(cur - x[pos]) > abs(x[max_index] - x[pos])) {
          max_index = i;
        }
      }
      if (max_index != -1) {
        len -= abs(x[max_index] - x[pos]);
        pos = max_index;
        no_change = 0;
      } else {
        no_change++;
        isl ^= 1;
      }
    }
    res.push_back(pos + 1);
  }
  return res;
}
pair<vector<int>, vector<pair<int, int>>> gen_test() {
  int n = 10;
  int m = 10;
  vector<int> x;
  set<int> S;
  while (S.size() < n) S.insert(rand() % 100);
  for (auto el : S) x.push_back(el);
  random_shuffle(x.begin(), x.end());
  vector<pair<int, int>> q;
  for (int i = 0; i < m; i++) {
    q.push_back({rand() % n + 1, rand() % 1000 + 1});
  }
  return {x, q};
}
void stress() {
  const int tests = 100;
  for (int i = 0; i < tests; i++) {
    cerr << "Test number " << i << endl;
    auto t = gen_test();
    cerr << "Generated test :: \n";
    for (auto el : t.first) cerr << el << " ";
    cerr << "\n";
    for (auto el : t.second) cerr << el.first << " " << el.second << "\n";
    auto slow_res = solve_slow(t.first, t.second);
    auto fast_res = solve(t.first, t.second);
    assert(slow_res == fast_res);
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> x(n);
  for (int i = 0; i < n; i++) cin >> x[i];
  vector<pair<int, int>> q(m);
  for (int i = 0; i < m; i++) cin >> q[i].first >> q[i].second;
  auto ans = solve(x, q);
  for (auto el : ans) cout << el << "\n";
  return 0;
}
