#include <bits/stdc++.h>
using namespace std;
int n, q, a[200001], c1, c2, r1, r2, st1[200001], st2[200001], bit[200001],
    cnt[200001], b[200001], ans1[200001][3], ans2[200001][4];
int t1, t2, t3;
int lowbit(int x) { return (x & -x); }
bool cmp1(int x, int y) { return a[x] < a[y]; }
bool cmp2(int x, int y) { return a[x] > a[y]; }
void insert(int x) {
  int y;
  bit[x] = x;
  while ((y = x + lowbit(x)) <= n) {
    bit[y] = max(bit[x], bit[y]);
    x = y;
  }
}
int query(int x) {
  int res = 0;
  while (x) {
    res = max(res, bit[x]);
    x -= lowbit(x);
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  memset(bit, 0, sizeof(bit));
  c1 = c2 = r1 = r2 = 0;
  for (int i = 1; i <= n; i++) {
    while (c1) {
      int u = st1[c1 - 1];
      if (a[u] > a[i]) {
        c1--;
        cnt[u]--;
        if (!cnt[u]) insert(u);
        r1 = 0;
      } else
        break;
    }
    while (c2) {
      int u = st2[c2 - 1];
      if (a[u] < a[i]) {
        c2--;
        cnt[u]--;
        if (!cnt[u]) insert(u);
        r2 = 0;
      } else
        break;
    }
    int s1 = lower_bound(st1, st1 + c1, i, cmp1) - st1 - 1,
        s2 = lower_bound(st2, st2 + c2, i, cmp2) - st2 - 1;
    b[i] = i - max(r1, r2);
    ans1[i][0] = i;
    ans1[i][1] = b[i];
    ans1[i][2] = b[i] - 1;
    if (s1 >= 0 && s2 >= 0) {
      t3 = query(min(st1[s1], st2[s2]));
      ans2[i][0] = i;
      if (t3) {
        t1 = lower_bound(st1, st1 + c1, t3, less<int>()) - st1;
        t2 = lower_bound(st2, st2 + c2, t3, less<int>()) - st2;
        ans2[i][1] = max(st1[t1], st2[t2]);
        ans2[i][2] = min(st1[t1], st2[t2]);
      }
      ans2[i][3] = t3;
    }
    st1[c1++] = i;
    st2[c2++] = i;
    cnt[i] += 2;
    r1++;
    r2++;
    if (i > 1 && ans1[i - 1][2] > ans1[i][2])
      for (int j = 0; j < 3; j++) ans1[i][j] = ans1[i - 1][j];
    if (i > 1 && ans2[i - 1][3] > ans2[i][3])
      for (int j = 0; j < 4; j++) ans2[i][j] = ans2[i - 1][j];
  }
  while (q--) {
    int l, r;
    cin >> l >> r;
    if (l <= ans2[r][3]) {
      cout << "4" << endl;
      for (int i = 3; i >= 0; i--) cout << ans2[r][i] << " ";
      cout << endl;
    } else if (l <= ans1[r][2]) {
      cout << "3" << endl;
      for (int i = 2; i >= 0; i--) cout << ans1[r][i] << " ";
      cout << endl;
    } else
      cout << "0" << endl;
  }
  return 0;
}
