#include <bits/stdc++.h>
using namespace std;
namespace Fread {
const int MAXN = 1 << 20;
char buf[MAXN], *S, *T;
inline char getchar() {
  if (S == T) {
    T = (S = buf) + fread(buf, 1, MAXN, stdin);
    if (S == T) return EOF;
  }
  return *S++;
}
}  // namespace Fread
template <typename T>
inline void read(T& x) {
  x = 0;
  int f = 1;
  char ch = Fread::getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = Fread::getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch - '0'), ch = Fread::getchar();
  x *= f;
}
const int MAXN = 2e5;
int n, q, a[MAXN + 5];
struct Ans3 {
  int p1, p2, p3;
  Ans3() { p3 = MAXN + 1; }
} ans3[MAXN + 5];
struct Ans4 {
  int p1, p2, p3, p4;
  Ans4() { p4 = MAXN + 1; }
} ans4[MAXN + 5];
struct SegmentTree {
  int mx[MAXN * 4 + 5], mn[MAXN * 4 + 5];
  void build(int p, int l, int r) {
    if (l == r) {
      mx[p] = mn[p] = a[l];
      return;
    }
    int mid = (l + r) >> 1;
    build(p << 1, l, mid);
    build(p << 1 | 1, mid + 1, r);
    mx[p] = max(mx[p << 1], mx[p << 1 | 1]);
    mn[p] = min(mn[p << 1], mn[p << 1 | 1]);
  }
  int _nxt_bigger(int p, int l, int r, int v) {
    if (l == r) {
      assert(mx[p] > v);
      return l;
    }
    int mid = (l + r) >> 1;
    if (mx[p << 1] > v)
      return _nxt_bigger(p << 1, l, mid, v);
    else
      return _nxt_bigger(p << 1 | 1, mid + 1, r, v);
  }
  int nxt_bigger(int p, int l, int r, int pos, int v) {
    if (mx[p] <= v) return n + 1;
    if (l >= pos) return _nxt_bigger(p, l, r, v);
    int mid = (l + r) >> 1, res = n + 1;
    if (pos <= mid) res = nxt_bigger(p << 1, l, mid, pos, v);
    if (res != n + 1)
      return res;
    else
      return nxt_bigger(p << 1 | 1, mid + 1, r, pos, v);
  }
  int _nxt_smaller(int p, int l, int r, int v) {
    if (l == r) {
      assert(mn[p] < v);
      return l;
    }
    int mid = (l + r) >> 1;
    if (mn[p << 1] < v)
      return _nxt_smaller(p << 1, l, mid, v);
    else
      return _nxt_smaller(p << 1 | 1, mid + 1, r, v);
  }
  int nxt_smaller(int p, int l, int r, int pos, int v) {
    if (mn[p] >= v) return n + 1;
    if (l >= pos) return _nxt_smaller(p, l, r, v);
    int mid = (l + r) >> 1, res = n + 1;
    if (pos <= mid) res = nxt_smaller(p << 1, l, mid, pos, v);
    if (res != n + 1)
      return res;
    else
      return nxt_smaller(p << 1 | 1, mid + 1, r, pos, v);
  }
  SegmentTree() {}
} T;
int sta1[MAXN + 5], sta2[MAXN + 5], top1, top2, insta[MAXN + 5];
int main() {
  read(n);
  read(q);
  for (int i = 1; i <= n; ++i) read(a[i]);
  T.build(1, 1, n);
  for (int i = n - 2; i >= 1; --i) {
    int x = T.nxt_bigger(1, 1, n, i, a[i]), y = n + 1;
    if (x < n) y = T.nxt_smaller(1, 1, n, x, a[x]);
    if (y != n + 1) {
      ans3[i].p1 = i;
      ans3[i].p2 = x;
      ans3[i].p3 = y;
    }
    x = T.nxt_smaller(1, 1, n, i, a[i]), y = n + 1;
    if (x < n) y = T.nxt_bigger(1, 1, n, x, a[x]);
    if (y < ans3[i].p3) {
      ans3[i].p1 = i;
      ans3[i].p2 = x;
      ans3[i].p3 = y;
    }
    if (i != n - 2 && ans3[i + 1].p3 < ans3[i].p3) ans3[i] = ans3[i + 1];
  }
  set<int> s;
  for (int i = n; i >= 1; --i) {
    while (top1) {
      int p = sta1[top1];
      if (a[p] > a[i]) {
        insta[p]--;
        if (!insta[p]) s.insert(p);
        top1--;
      } else
        break;
    }
    while (top2) {
      int p = sta2[top2];
      if (a[p] < a[i]) {
        insta[p]--;
        if (!insta[p]) s.insert(p);
        top2--;
      } else
        break;
    }
    int p1 = 0, p2 = 0;
    int l = 0, r = top1;
    while (l < r) {
      int mid = (l + r + 1) >> 1;
      if (a[sta1[mid]] < a[i])
        l = mid;
      else
        r = mid - 1;
    }
    p1 = l;
    l = 0, r = top2;
    while (l < r) {
      int mid = (l + r + 1) >> 1;
      if (a[sta2[mid]] > a[i])
        l = mid;
      else
        r = mid - 1;
    }
    p2 = l;
    if (p1 && p2) {
      set<int>::iterator it = s.upper_bound(max(sta1[p1], sta2[p2]));
      if (it != s.end()) {
        l = 1, r = p1;
        while (l < r) {
          int mid = (l + r) >> 1;
          if (sta1[mid] < (*it))
            r = mid;
          else
            l = mid + 1;
        }
        p1 = sta1[l];
        l = 1, r = p2;
        while (l < r) {
          int mid = (l + r) >> 1;
          if (sta2[mid] < (*it))
            r = mid;
          else
            l = mid + 1;
        }
        p2 = sta2[l];
        ans4[i].p1 = i;
        ans4[i].p2 = min(p1, p2);
        ans4[i].p3 = max(p1, p2);
        ans4[i].p4 = (*it);
      }
    }
    if (ans4[i + 1].p4 < ans4[i].p4) ans4[i] = ans4[i + 1];
    insta[i] = 2;
    sta1[++top1] = i;
    sta2[++top2] = i;
  }
  while (q--) {
    int l, r;
    read(l);
    read(r);
    if (ans4[l].p4 <= r) {
      printf("%d\n%d %d %d %d\n", 4, ans4[l].p1, ans4[l].p2, ans4[l].p3,
             ans4[l].p4);
    } else if (ans3[l].p3 <= r) {
      printf("%d\n%d %d %d\n", 3, ans3[l].p1, ans3[l].p2, ans3[l].p3);
    } else {
      puts("0\n");
    }
  }
  return 0;
}
