#include <bits/stdc++.h>
using namespace std;
const int MX = 200005;
int n, q, a[MX], cn[MX], l[MX], r[MX];
vector<int> res[MX], pos[MX], b4;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  set<int> inc, dec, mx, mn, no, noinc, nodec;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i < q; i++) {
    cin >> l[i] >> r[i];
    pos[l[i]].push_back(i);
  }
  for (int i = n, x; i > 0; i--) {
    cn[i] = 2;
    while (inc.size() && a[x = *inc.begin()] < a[i]) {
      noinc.insert(x);
      cn[x]--;
      if (!cn[x]) no.insert(x);
      inc.erase(x);
    }
    while (dec.size() && a[x = *dec.begin()] > a[i]) {
      nodec.insert(x);
      cn[x]--;
      if (!cn[x]) no.insert(x);
      dec.erase(x);
    }
    while (mx.size() && a[x = *mx.begin()] <= a[i]) mx.erase(x);
    while (mn.size() && a[x = *mn.begin()] >= a[i]) mn.erase(x);
    if (mx.size() && mn.size()) {
      auto it = no.lower_bound(max(*mx.begin(), *mn.begin()));
      if (it != no.end() && (b4.empty() || *it < b4.back())) {
        b4 = {i, *it};
        auto jt = inc.lower_bound(*it);
        jt--;
        b4.push_back(*jt);
        jt = dec.lower_bound(*it);
        jt--;
        b4.push_back(*jt);
        sort(b4.begin(), b4.end());
      }
    }
    for (int j : pos[i]) {
      if (b4.size() && b4.back() <= r[j])
        res[j] = b4;
      else {
        if (mx.size()) {
          auto it = noinc.lower_bound(*mx.begin());
          if (it != noinc.end() && *it <= r[j]) res[j] = {i, *it - 1, *it};
        }
        if (mn.size()) {
          auto it = nodec.lower_bound(*mn.begin());
          if (it != nodec.end() && *it <= r[j]) res[j] = {i, *it - 1, *it};
        }
      }
    }
    inc.insert(i), dec.insert(i), mx.insert(i), mn.insert(i);
  }
  for (int i = 0; i < q; i++) {
    cout << res[i].size() << '\n';
    for (int x : res[i]) cout << x << " ";
    cout << '\n';
  }
  return 0;
}
