#include <bits/stdc++.h>
using namespace std;
template <typename T>
void maxtt(T& t1, T t2) {
  t1 = max(t1, t2);
}
template <typename T>
void mintt(T& t1, T t2) {
  t1 = min(t1, t2);
}
bool debug = 0;
int n, m, k;
string direc = "RDLU";
const long long MOD2 = (long long)998244353 * (long long)998244353;
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int& x, int y, int mod = 998244353) {
  x += y;
  if (x >= mod) x -= mod;
  if (x < 0) x += mod;
  assert(x >= 0 && x < mod);
}
void et(int x = -1) {
  printf("%d\n", x);
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 998244353) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) { return y ? gcd1(y, x % y) : x; }
int a[200135], ql[200135], qr[200135];
vector<int> ans[200135], pos[200135];
void ser() {
  map<int, int> mp;
  int cnt = 0;
  for (int(i) = 1; (i) <= (int)(n); (i)++) mp[a[i]];
  for (auto& p : mp) p.second = ++cnt;
  for (int(i) = 1; (i) <= (int)(n); (i)++) a[i] = mp[a[i]];
}
const int MN = (1 << 19) + 5;
struct mb {
  int M, T[MN];
  void init(int sz) {
    for (M = 1; sz + 2 > M; M <<= 1)
      ;
  }
  void init(int sz, int val) {
    for (M = 1; sz + 2 > M; M <<= 1)
      ;
    for (int(i) = 0; (i) < (int)(MN); (i)++) T[i] = val;
  }
  void clear() { memset(T, 0, sizeof T); }
  void uptSingleMax(int l, int val) {
    l += M;
    T[l] = max(T[l], val);
    while (l > 1) {
      T[l >> 1] = max(T[l], T[l ^ 1]);
      l >>= 1;
    }
  }
  int qyRangeMax(int l, int r) {
    if (r < l) return 0;
    int ans = 0;
    for (l = l + M - 1, r = r + M + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {
      if (~l & 1) ans = max(ans, T[l ^ 1]);
      if (r & 1) ans = max(ans, T[r ^ 1]);
    }
    return ans;
  }
} T[2];
vector<int> a3, a4;
int mx3, mx4, scnt[200135];
void fmain(int tid) {
  scanf("%d%d", &n, &m);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d", a + i);
  ser();
  for (int(i) = 1; (i) <= (int)(m); (i)++) {
    scanf("%d%d", ql + i, qr + i);
    pos[qr[i]].push_back(i);
  }
  for (int(i) = 0; (i) < (int)(2); (i)++) T[i].init(n, 0);
  set<int> fre;
  vector<int> vpA, vpD;
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    int up = T[0].qyRangeMax(a[i] + 1, n);
    int dn = T[1].qyRangeMax(1, a[i] - 1);
    if (up && dn && !fre.empty()) {
      int idx = min(up, dn) - 1;
      auto it = fre.upper_bound(idx);
      if (it != fre.begin()) {
        it--;
        idx = *it;
        if (idx > mx4) {
          a4.clear();
          mx4 = idx;
          a4 = {idx, min(dn, up), max(dn, up), i};
        }
      }
    }
    if (up) {
      int idx = up - 1;
      if (idx > mx3) {
        mx3 = idx;
        a3.clear();
        a3 = {idx, up, i};
      }
    }
    if (dn) {
      int idx = dn - 1;
      if (idx > mx3) {
        mx3 = idx;
        a3.clear();
        a3 = {idx, dn, i};
      }
    }
    for (int qid : pos[i]) {
      int L = ql[qid];
      if (L <= mx4)
        ans[qid] = a4;
      else if (L <= mx3)
        ans[qid] = a3;
    }
    if (i > 1) {
      if (a[i] > a[i - 1]) T[0].uptSingleMax(a[i], i);
      if (a[i] < a[i - 1]) T[1].uptSingleMax(a[i], i);
    }
    while (!vpA.empty() && a[vpA.back()] > a[i]) {
      scnt[vpA.back()]++;
      if (scnt[vpA.back()] == 2) fre.insert(vpA.back());
      vpA.pop_back();
    }
    vpA.push_back(i);
    while (!vpD.empty() && a[vpD.back()] < a[i]) {
      scnt[vpD.back()]++;
      if (scnt[vpD.back()] == 2) fre.insert(vpD.back());
      vpD.pop_back();
    }
    vpD.push_back(i);
  }
  for (int(i) = 1; (i) <= (int)(m); (i)++) {
    printf("%d\n", (int)ans[i].size());
    for (int z : ans[i]) printf("%d ", z);
    puts("");
  }
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
