#include <bits/stdc++.h>
using namespace std;
pair<int, int> f[200000];
int inv[200000];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &f[i].first);
    f[i].second = i;
  }
  sort(f, f + n);
  for (int i = 0; i < n; i++) {
    inv[f[i].second] = i;
  }
  for (int i = 0; i < m; i++) {
    int d = 1;
    int a, b;
    scanf("%d %d", &a, &b);
    int u = inv[a - 1];
    if (b >= 2 * f[n - 1].first - f[0].first - f[u].first &&
        2 * f[n - 1].first - f[0].first - f[u].first > 0) {
      b -= (f[n - 1].first * 2 - f[0].first - f[u].first);
      b %= (f[n - 1].first - f[0].first) * 2;
      b += (f[n - 1].first * 2 - f[0].first - f[u].first);
    }
    int cnt = 0, pre = -1;
    while (1) {
      if (d == 1) {
        int top = n - 1, bot = u + 1, ans = -1;
        while (top >= bot) {
          int mid = (top + bot) / 2;
          if (f[mid].first - f[u].first > b) {
            top = mid - 1;
          } else {
            bot = mid + 1;
            ans = mid;
          }
        }
        if (ans == -1) {
          if (cnt) {
            printf("%d\n", f[u].second + 1);
            break;
          }
          pre = -1;
          cnt++;
        } else {
          if (pre == ans && b > 2 * (f[pre].first - f[u].first)) {
            b %= 2 * (f[pre].first - f[u].first);
            continue;
          }
          b -= f[ans].first - f[u].first;
          pre = u;
          u = ans;
          cnt = 0;
        }
        d = 0;
      } else {
        int top = u - 1, bot = 0, ans = -1;
        while (top >= bot) {
          int mid = (top + bot) / 2;
          if (f[u].first - f[mid].first > b) {
            bot = mid + 1;
          } else {
            top = mid - 1;
            ans = mid;
          }
        }
        if (ans == -1) {
          if (cnt) {
            printf("%d\n", f[u].second + 1);
            break;
          }
          pre = -1;
          cnt++;
        } else {
          if (pre == ans && b > 2 * (f[u].first - f[pre].first)) {
            b %= 2 * (f[u].first - f[pre].first);
            continue;
          }
          b -= f[u].first - f[ans].first;
          pre = u;
          u = ans;
          cnt = 0;
        }
        d = 1;
      }
    }
  }
  return 0;
}
