#include <bits/stdc++.h>
using ll = long long;
int n, q;
namespace BIT {
int seg[100005];
inline void modify(int pos, int val) {
  for (; pos <= n; pos += pos & -pos) seg[pos] += val;
}
inline int query(int pos) {
  int res = 0;
  for (; pos; pos -= pos & -pos) res += seg[pos];
  return res;
}
inline int calc_idx(int x) {
  int l = 1, r = n, res = n + 1;
  while (l <= r) {
    int m = l + r >> 1;
    if (query(m) > x) {
      res = m;
      r = m - 1;
    } else
      l = m + 1;
  }
  modify(res, -1);
  return res;
}
}  // namespace BIT
namespace segT {
int lson[20000005], rson[20000005], sum[20000005], t_cnt;
void modify(int &u, int v, int l, int r, int pos) {
  u = ++t_cnt;
  lson[u] = lson[v];
  rson[u] = rson[v];
  sum[u] = sum[v] + 1;
  if (l == r) return;
  int m = l + r >> 1;
  if (pos <= m)
    modify(lson[u], lson[v], l, m, pos);
  else
    modify(rson[u], rson[v], m + 1, r, pos);
}
int query_rk(int u, int l, int r, int rk) {
  if (l == r) return l;
  int m = l + r >> 1;
  if (sum[lson[u]] > rk) return query_rk(lson[u], l, m, rk);
  return query_rk(rson[u], m + 1, r, rk - sum[lson[u]]);
}
int query_sum(int u, int l, int r, int pos) {
  if (r <= pos) return sum[u];
  int m = l + r >> 1, res = 0;
  if (m < pos) res = query_sum(rson[u], m + 1, r, pos);
  return query_sum(lson[u], l, m, pos) + res;
}
}  // namespace segT
int rep[100005], enp[100005], arr[100005], idx[100005], rt[100005];
ll pre[100005];
std::pair<ll, int> calc(int out, int in, int t) {
  in += rep[out] - t;
  int res = std::upper_bound(rep, rep + n, in) - rep;
  return {(ll)in * res - pre[res], res};
}
int query_out(int x, int t) {
  int l = 0, r = n - 1, res = -1;
  while (l <= r) {
    int m = l + r >> 1;
    if (calc(m, 0, t).first <= x) {
      res = m;
      l = m + 1;
    } else
      r = m - 1;
  }
  return res;
}
int query_in(int out, int x, int t) {
  int l = 0, r = rep[out + 1] - rep[out], res = -1;
  if (out == n - 1) r = x / n + t + 1;
  while (l <= r) {
    int m = l + r >> 1;
    if (calc(out, m, t).first <= x) {
      res = m;
      l = m + 1;
    } else
      r = m - 1;
  }
  return res;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 0; i < n; i++) scanf("%d", arr + i);
  int stp = arr[0];
  for (int i = 0; i < n; i++) arr[i] -= stp;
  for (int i = 1; i < n; i++) {
    rep[i] = rep[i - 1] + (arr[i] - enp[i - 1]) / i;
    enp[i] = enp[i - 1] + (rep[i] - rep[i - 1]) * i;
    pre[i + 1] = pre[i] + rep[i];
  }
  for (int i = 1; i <= n; i++) BIT::modify(i, 1);
  for (int i = n - 1; i >= 0; i--) idx[i] = BIT::calc_idx(arr[i] - enp[i]) - 1;
  for (int i = 0; i < n; i++) segT::modify(rt[i + 1], rt[i], 0, n - 1, idx[i]);
  while (q--) {
    int x, t;
    scanf("%d%d", &x, &t);
    if (x < stp) {
      printf("%d\n", x);
      continue;
    }
    x -= stp;
    int a = query_out(x, t), b = query_in(a, x, t);
    auto res = calc(a, b, t);
    int rem = x - res.first, rk = segT::query_rk(rt[res.second], 0, n - 1, rem);
    printf("%lld\n",
           stp + enp[a] + (ll)b * (a + 1) +
               (rk ? segT::query_sum(rt[a + 1], 0, n - 1, rk - 1) : 0));
  }
  return 0;
}
