#include <bits/stdc++.h>
using namespace std;
int n, m, pre[400050], nex[400050];
int cnt, d[800050];
int a[400050], b[400050], h[400050];
struct Seg {
  int sum, rt[400050];
  int mx[10000060], ls[10000060], rs[10000060];
  int f[800050];
  inline int Max(int x, int y) {
    if (f[x] != f[y]) return ((f[x] > f[y]) ? x : y);
    return ((x < y) ? x : y);
  }
  void Add(int k, int &kk, int l, int r, const int &x, const int &v) {
    kk = ++sum;
    mx[kk] = Max(mx[k], v);
    if (l == r) return;
    int mid = l + r >> 1;
    if (x <= mid)
      rs[kk] = rs[k], Add(ls[k], ls[kk], l, mid, x, v);
    else
      ls[kk] = ls[k], Add(rs[k], rs[kk], mid + 1, r, x, v);
  }
  int Ask(int k, int l, int r, const int &x) {
    if (!k) return 0;
    if (r <= x) return mx[k];
    int mid = l + r >> 1;
    if (x > mid) return Max(mx[ls[k]], Ask(rs[k], mid + 1, r, x));
    return Ask(ls[k], l, mid, x);
  }
} Pre, Nex;
int Val[1600050];
void Pd(int k, int l, int r) {
  if (l == r) return;
  if (Val[k] > Val[k << 1]) Val[k << 1] = Val[k];
  if (Val[k] > Val[k << 1 | 1]) Val[k << 1 | 1] = Val[k];
  int mid = l + r >> 1;
  Pd(k << 1, l, mid);
  Pd(k << 1 | 1, mid + 1, r);
}
void Modify(int k, int l, int r, const int &x, const int &y, const int &v) {
  if (x <= l && r <= y) {
    if (v > Val[k]) Val[k] = v;
    return;
  }
  int mid = l + r >> 1;
  if (x <= mid) Modify(k << 1, l, mid, x, y, v);
  if (y > mid) Modify(k << 1 | 1, mid + 1, r, x, y, v);
}
int Ask(int k, int l, int r, const int &x) {
  if (l == r) return Val[k];
  int mid = l + r >> 1;
  if (x <= mid) return Ask(k << 1, l, mid, x);
  return Ask(k << 1 | 1, mid + 1, r, x);
}
int main() {
  scanf("%d%d", &n, &m);
  cnt = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", h + i);
    d[++cnt] = h[i];
  }
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", &a[i], &b[i]);
    d[++cnt] = b[i];
  }
  sort(d + 1, d + cnt + 1);
  cnt = unique(d + 1, d + cnt + 1) - d - 1;
  for (int i = 1; i <= n; ++i) h[i] = lower_bound(d + 1, d + cnt + 1, h[i]) - d;
  for (int i = 1; i <= n; ++i) {
    if (h[i] > 1)
      pre[i] = Pre.Ask(Pre.rt[i - 1], 1, cnt, h[i] - 1);
    else
      pre[i] = 0;
    Pre.f[i] = Pre.f[pre[i]] + 1;
    Pre.Add(Pre.rt[i - 1], Pre.rt[i], 1, cnt, h[i], i);
  }
  int x;
  for (int i = n; i; --i) {
    if (h[i] < cnt)
      x = Nex.Ask(Nex.rt[i + 1], 1, cnt, cnt - h[i]);
    else
      x = 0;
    nex[i] = n - x + 1;
    Nex.f[n - i + 1] = Nex.f[x] + 1;
    Nex.Add(Nex.rt[i + 1], Nex.rt[i], 1, cnt, cnt - h[i] + 1, n - i + 1);
  }
  for (int i = 1; i <= n; ++i) {
    x = Pre.f[i] + Nex.f[n - i + 1] - 1;
    if (pre[i] + 1 < i) Modify(1, 1, n, pre[i] + 1, i - 1, x);
    if (i < nex[i] - 1) Modify(1, 1, n, i + 1, nex[i] - 1, x);
    Modify(1, 1, n, i, i, x - 1);
    if (pre[i]) Modify(1, 1, n, 1, pre[i], x - 1);
    if (nex[i] <= n) Modify(1, 1, n, nex[i], n, x - 1);
  }
  Pd(1, 1, n);
  for (int i = 1; i <= m; ++i) {
    b[i] = lower_bound(d + 1, d + cnt + 1, b[i]) - d;
    printf("%d\n",
           max(Ask(1, 1, n, a[i]),
               Pre.f[Pre.Ask(Pre.rt[a[i] - 1], 1, cnt, b[i] - 1)] +
                   Nex.f[Nex.Ask(Nex.rt[a[i] + 1], 1, cnt, cnt - b[i])] + 1));
  }
}
