#include <bits/stdc++.h>
using namespace std;
const int N = 200514;
vector<int> a3[N], a4[N], mn, mx;
set<int> s;
int p3[N], p4[N];
int n, m, M, a[N], ct[N], l1 = 1, l2 = 1;
int j, p1, p2, k1, k2;
int main() {
  scanf("%d%d", &n, &m);
  p3[n + 1] = p4[n + 1] = n + 1;
  for (int i = (1); i <= (n); i++) scanf("%d", &a[i]);
  for (int i = (n); i >= (1); i--) {
    j = i - 1;
    p3[i] = p4[i] = n + 1;
    while (j >= 1 && a[i] == a[j]) j--;
    while (mn.size() && a[i] < a[mn.back()]) {
      if (!(--ct[mn.back()])) s.insert(mn.back());
      l1 = 0;
      mn.pop_back();
    }
    while (mx.size() && a[i] > a[mx.back()]) {
      if (!(--ct[mx.back()])) s.insert(mx.back());
      l2 = 0;
      mx.pop_back();
    }
    p1 = lower_bound(mn.begin(), mn.end(), i,
                     [&](int x, int y) { return a[x] < a[y]; }) -
         mn.begin() - 1;
    p2 = lower_bound(mx.begin(), mx.end(), i,
                     [&](int x, int y) { return a[x] > a[y]; }) -
         mx.begin() - 1;
    p3[i] = i + 1 + max(l1, l2);
    a3[i] = {i, p3[i] - 1, p3[i]};
    if (~p1 && ~p2) {
      auto it = s.lower_bound(max(mn[p1], mx[p2]));
      if (it != s.end()) {
        p4[i] = *it;
        k1 = upper_bound(mn.begin(), mn.end(), p4[i], greater<int>()) -
             mn.begin();
        k2 = upper_bound(mx.begin(), mx.end(), p4[i], greater<int>()) -
             mx.begin();
        a4[i] = {i, min(mn[k1], mx[k2]), max(mn[k1], mx[k2]), p4[i]};
      }
    }
    if (p3[i] > p3[i + 1]) a3[i] = a3[i + 1], p3[i] = p3[i + 1];
    if (p4[i] > p4[i + 1]) a4[i] = a4[i + 1], p4[i] = p4[i + 1];
    for (int k = (j + 1); k <= (i); k++) {
      l1++, l2++;
      mn.push_back(k), mx.push_back(k);
      ct[k] = 2;
      p3[k] = p3[i], p4[k] = p4[i], a3[k] = a3[i], a4[k] = a4[i];
    }
    i = j + 1;
  }
  int x, y;
  for (int i = (1); i <= (m); i++) {
    scanf("%d%d", &x, &y);
    if (p4[x] <= y) {
      puts("4");
      for (int l : a4[x]) printf("%d ", l);
      puts("");
    } else if (p3[x] <= y) {
      puts("3");
      for (int l : a3[x]) printf("%d ", l);
      puts("");
    } else
      puts("0");
  }
}
