#include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
long long MOD = 998244353;
long long exp(long long n, long long e) {
  if (e == 0) return 1;
  long long temp = exp((n * n) % MOD, e / 2);
  return e % 2 == 0 ? temp : (temp * n) % MOD;
}
long long inverse(long long n) { return exp(n, MOD - 2); }
void frac(long long p, long long q) {
  cout << (p * inverse(q)) % MOD << endl;
  ;
}
int LIM = 2e5 + 100;
vector<vector<int> > adj(LIM);
vector<vector<int> > dp(LIM, vector<int>(3, 0));
int n;
vector<int> GREATER(LIM, 0);
vector<int> lesser(LIM, 0);
vector<int> RIGHT(LIM, 0);
vector<pair<int, int> > tree(2 * LIM);
vector<pair<pair<int, int>, pair<int, int> > > tree2(2 * LIM);
vector<pair<int, int> > tree3(2 * LIM);
vector<pair<pair<int, int>, pair<int, int> > > tree4(2 * LIM);
vector<pair<int, int> > tree5(2 * LIM);
pair<pair<int, int>, pair<int, int> > combine(
    pair<pair<int, int>, pair<int, int> > a,
    pair<pair<int, int>, pair<int, int> > b) {
  pair<pair<int, int>, pair<int, int> > ans;
  if (a.first.first < b.first.first)
    ans.first = a.first;
  else
    ans.first = b.first;
  if (a.second.first > b.second.first)
    ans.second = a.second;
  else
    ans.second = b.second;
  return ans;
}
void update(int pos, pair<pair<int, int>, pair<int, int> > value,
            vector<pair<pair<int, int>, pair<int, int> > > &tree) {
  pos += n - 1;
  tree[pos] = value;
  pos = pos / 2;
  while (pos >= 1) {
    tree[pos] = combine(tree[2 * pos], tree[2 * pos + 1]);
    pos = pos / 2;
  }
}
pair<pair<int, int>, pair<int, int> > query(
    int l, int r, vector<pair<pair<int, int>, pair<int, int> > > &tree) {
  l += n - 1;
  r += n - 1;
  pair<pair<int, int>, pair<int, int> > ans(pair<int, int>(1e9, -1),
                                            pair<int, int>(-1e9, -1));
  while (l <= r) {
    if (l % 2 == 1) {
      ans = combine(ans, tree[l]);
      l++;
    }
    if (r % 2 == 0) {
      ans = combine(ans, tree[r]);
      r--;
    }
    l = l / 2;
    r = r / 2;
  }
  return ans;
}
pair<int, int> combine2(pair<int, int> a, pair<int, int> b) {
  if (a.first <= b.first)
    return a;
  else
    return b;
}
void update2(int pos, pair<int, int> value, vector<pair<int, int> > &tree) {
  pos += n - 1;
  tree[pos] = value;
  pos = pos / 2;
  while (pos >= 1) {
    tree[pos] = combine2(tree[2 * pos], tree[2 * pos + 1]);
    pos = pos / 2;
  }
}
pair<int, int> query2(int l, int r, vector<pair<int, int> > &tree) {
  l += n - 1;
  r += n - 1;
  pair<int, int> ans(1e9, -1e9);
  while (l <= r) {
    if (l % 2 == 1) {
      ans = combine2(ans, tree[l]);
      l++;
    }
    if (r % 2 == 0) {
      ans = combine2(ans, tree[r]);
      r--;
    }
    l = l / 2;
    r = r / 2;
  }
  return ans;
}
vector<int> arr(LIM, 0);
vector<int> a(LIM), b(LIM);
void pop(vector<int> &stk, int &x, vector<int> &a) {
  a[stk[x]]--;
  if (a[stk[x]] == 0) {
    update2(stk[x], pair<int, int>(0, 0), tree);
  }
  x--;
}
void push(vector<int> &stk, int &x, int i, vector<int> &a) {
  a[i]++;
  if (a[i] == 1) update2(i, pair<int, int>(1, 1), tree);
  x++;
  stk[x] = i;
}
int BS(int x) {
  int l = x;
  int r = n;
  if (query2(l, r, tree).first != 0) return n + 1;
  while (l < r) {
    int mid = (l + r) / 2;
    if (query2(l, mid, tree).first == 0)
      r = mid;
    else
      l = mid + 1;
  }
  return l;
}
int x = 0;
int y = 0;
void solve() {
  int q;
  cin >> n >> q;
  arr[0] = -1;
  arr[n + 1] = -1;
  for (int i = 1; i <= n; i++) cin >> arr[i];
  vector<int> ri(n + 2, -1), le(n + 2, -1);
  for (int i = n; i >= 1; i--) {
    if (arr[i + 1] != arr[i])
      ri[i] = i + 1;
    else
      ri[i] = ri[i + 1];
    if (ri[i] == n + 1) ri[i] = -1;
  }
  for (int i = 1; i <= n; i++) {
    if (arr[i - 1] != arr[i])
      le[i] = i - 1;
    else
      le[i] = le[i - 1];
    if (le[i] == 0) le[i] = -1;
  }
  for (int i = n; i >= 1; i--) {
    while (x > 0 && arr[GREATER[x]] < arr[i]) pop(GREATER, x, a);
    push(GREATER, x, i, a);
    assert(a[i] > 0);
    while (y > 0 && arr[lesser[y]] > arr[i]) pop(lesser, y, a);
    push(lesser, y, i, a);
    assert(a[i] > 0);
    if (x < 2 || y < 2) {
      RIGHT[i] = n + 1;
      continue;
    }
    if (arr[GREATER[1]] <= arr[i] || arr[lesser[1]] >= arr[i]) {
      RIGHT[i] = n + 1;
      continue;
    }
    int l = 1, r = x;
    while (l < r) {
      int mid = (l + r) / 2;
      if (arr[GREATER[mid]] > arr[i])
        l = mid + 1;
      else
        r = mid;
    }
    int x2 = l - 1;
    l = 1, r = y;
    while (l < r) {
      int mid = (l + r) / 2;
      if (arr[lesser[mid]] < arr[i])
        l = mid + 1;
      else
        r = mid;
    }
    int y2 = l - 1;
    RIGHT[i] = BS(max(GREATER[x2], lesser[y2]));
  }
  for (int i = 1; i <= n; i++) {
    update(i,
           pair<pair<int, int>, pair<int, int> >(pair<int, int>(arr[i], i),
                                                 pair<int, int>(arr[i], i)),
           tree4);
    update(i,
           pair<pair<int, int>, pair<int, int> >(
               pair<int, int>(arr[i] - arr[i - 1], i),
               pair<int, int>(arr[i] - arr[i - 1], i)),
           tree2);
    update2(i, pair<int, int>(RIGHT[i], i), tree3);
    if (i == n) continue;
    long long val = 0;
    if (le[i] == -1 || ri[i] == -1)
      val = 0;
    else {
      val =
          ((long long)(arr[i] - arr[le[i]])) * (long long)(arr[ri[i]] - arr[i]);
      if (val > 0)
        val = 1;
      else if (val < 0)
        val = -1;
      else
        val = 0;
    }
    update2(i, pair<int, int>(val, i), tree5);
  }
  for (int i = 1; i <= n; i++) {
    if (RIGHT[i] <= n) {
      pair<pair<int, int>, pair<int, int> > temp = query(i, RIGHT[i], tree4);
      assert(temp.first.first < arr[i] && temp.first.first < arr[RIGHT[i]]);
      assert(temp.second.first > arr[i] && temp.second.first > arr[RIGHT[i]]);
    }
  }
  for (int i = 1; i <= q; i++) {
    int l, r;
    cin >> l >> r;
    pair<pair<int, int>, pair<int, int> > exists = query(l + 1, r, tree2);
    if (exists.second.first <= 0 || exists.first.first >= 0) {
      cout << 0 << endl;
      continue;
    }
    pair<int, int> check2 = query2(l, r, tree3);
    int l1 = -1, r1 = -1;
    if (check2.first <= r) {
      cout << 4 << endl;
      vector<int> ans(4, 0);
      ans[3] = check2.first;
      ans[0] = check2.second;
      pair<pair<int, int>, pair<int, int> > temp = query(ans[0], ans[3], tree4);
      ans[1] = temp.first.second;
      ans[2] = temp.second.second;
      sort((ans).begin(), (ans).end());
      for (int i = 0; i < 4; i++) cout << ans[i] << " ";
      cout << endl;
      l1 = ans[0];
      r1 = ans[2];
    } else {
      cout << 3 << endl;
      pair<int, int> temp = query2(ri[l], le[r], tree5);
      vector<int> ans(3, 0);
      ans[0] = le[temp.second];
      ans[1] = temp.second;
      ans[2] = ri[temp.second];
      for (int i = 0; i < 3; i++) cout << ans[i] << " ";
      cout << endl;
      l1 = ans[0];
      r1 = ans[2];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
