#include <bits/stdc++.h>
using namespace std;
vector<int> que;
int n, q;
vector<pair<int, int> > ar;
pair<int, int> bin(int po, int l, int r) {
  int m = (l + r) / 2;
  if (po == ar[l].first) return {l, l};
  if (po == ar[r].first) return {r, r};
  if (r - l == 1) return {l, r};
  if (po == ar[m].first) {
    return {m, m};
  } else {
    if (po < ar[m].first) {
      return bin(po, l, m);
    } else
      return bin(po, m, r);
  }
}
int solve(int st, int length) {
  while (true) {
    int lengba = length;
    int stb = st;
    pair<int, int> fp;
    if (st + length >= ar[n - 1].first) {
      fp.second = -1;
      fp.first = n - 1;
    } else {
      fp = bin(st + length, 0, n - 1);
    }
    length -= (ar[fp.first].first - st);
    pair<int, int> sp;
    int nst = ar[fp.first].first;
    if (nst - length <= ar[0].first) {
      sp.first = -1;
      sp.second = 0;
    } else {
      sp = bin(nst - length, 0, n - 1);
    }
    length -= (nst - ar[sp.second].first);
    st = ar[sp.second].first;
    if (lengba == length) {
      return ar[sp.second].second;
    }
    if (stb == st) {
      length = (length % (2 * ar[fp.first].first - 2 * stb));
    }
  }
}
int main() {
  cin >> n >> q;
  vector<int> ra;
  for (int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    ra.push_back(x);
    ar.push_back({x, i + 1});
  }
  sort(ar.begin(), ar.end());
  for (int i = 0; i < q; i++) {
    int st, l;
    cin >> st >> l;
    cout << solve(ra[st - 1], l) << endl;
    ;
  }
  return 0;
}
