#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 10;
struct pairs {
  bool operator()(const pair<long long, int>& pa,
                  const pair<long long, int>& pb) const {
    if (pa.first == pb.first) return pa.second > pb.second;
    return pa.first < pb.first;
  }
};
set<pair<long long, int>, pairs> s[N];
int main() {
  ios_base::sync_with_stdio(false);
  int n, q;
  cin >> n >> q;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int tot = 0;
  for (int i = 0; i < n; i++) {
    int from = 0;
    int to = n + 1;
    int best = -1;
    while (from <= to) {
      int avg = (from + to) / 2;
      if (s[avg].empty()) {
        to = avg - 1;
        continue;
      }
      long long cur = s[avg].begin()->first;
      if (cur < a[i]) {
        from = avg + 1;
        best = avg;
      } else {
        to = avg - 1;
      }
    }
    s[best + 1].insert({a[i], i});
    tot = max(tot, best + 1);
  }
  vector<bool> good(n, false);
  for (auto x : s[tot]) good[x.second] = true;
  for (int i = tot + 1 - 1; i >= 1; i--) {
    auto it = s[i - 1].begin();
    for (auto x : s[i]) {
      if (!good[x.second]) continue;
      while (it != s[i - 1].end() && it->first < x.first) {
        if (it->second < x.second) good[it->second] = true;
        it++;
      }
    }
  }
  vector<bool> must(n, false);
  for (int i = 0; i < tot + 1; i++) {
    int gc = 0;
    int cur = 0;
    for (auto x : s[i]) {
      if (good[x.second]) {
        gc++;
        cur = x.second;
      }
    }
    if (gc == 1) {
      must[cur] = true;
    }
  }
  vector<vector<pair<int, long long>>> queries(n);
  vector<int> res(q, 0);
  for (int i = 0; i < q; i++) {
    long long pos, h;
    cin >> pos >> h;
    pos--;
    if (must[pos]) {
      res[i] = tot;
    } else {
      res[i] = tot + 1;
    }
    queries[pos].push_back({i, h});
  }
  vector<int> lres(q, 0), rres(q, 0);
  vector<long long> lis(n + 2, 2e9);
  auto bins = [&](long long h, bool norm) {
    int from = 0;
    int to = n + 1;
    int best = -1;
    while (from <= to) {
      int avg = (from + to) / 2;
      long long cur = lis[avg];
      if ((norm && cur < h) || (!norm && cur > h)) {
        from = avg + 1;
        best = avg;
      } else {
        to = avg - 1;
      }
    }
    return best;
  };
  for (int i = 0; i < n; i++) {
    for (auto x : queries[i]) {
      lres[x.first] = bins(x.second, true) + 1;
    }
    int best = bins(a[i], true);
    lis[best + 1] = a[i];
  }
  for (int i = 0; i < n + 2; i++) lis[i] = -2e9;
  for (int i = n - 1; i >= 0; i--) {
    for (auto x : queries[i]) {
      rres[x.first] = bins(x.second, false) + 1;
    }
    int best = bins(a[i], false);
    lis[best + 1] = a[i];
  }
  for (int i = 0; i < q; i++) res[i] = max(res[i], lres[i] + 1 + rres[i]);
  for (auto x : res) cout << x << endl;
  return 0;
}
