Given a sequence of integers a of length n, a tuple (i,j,k) is called monotone triples if 

  * 1 ≤ i<j<k≤ n; 
  * a_i ≤ a_j ≤ a_k or a_i ≥ a_j ≥ a_k is satisfied. 



For example, a=[5,3,4,5], then (2,3,4) is monotone triples for sequence a while (1,3,4) is not.

Bob is given a sequence of integers a of length n in a math exam. The exams itself contains questions of form L, R, for each of them he is asked to find any subsequence b with size greater than 2 (i.e. |b| ≥ 3) of sequence a_L, a_{L+1},…, a_{R}.

Recall that an sequence b is a subsequence of sequence a if b can be obtained by deletion of several (possibly zero, or all) elements.

However, he hates monotone stuff, and he wants to find a subsequence free from monotone triples. Besides, he wants to find one subsequence with the largest length among all subsequences free from monotone triples for every query.

Please help Bob find out subsequences meeting the above constraints.

Input

The first line contains two integers n, q (3 ≤ n ≤ 2 ⋅ 10^5, 1 ≤ q ≤ 2 ⋅ 10^5) — the length of sequence a and the number of queries.

The second line contains n integers a_1,a_2,…, a_n (1 ≤ a_i ≤ 10^{9}), representing the sequence a.

Then each of the following q lines contains two integers L, R (1 ≤ L,R ≤ n, R-L≥ 2).

Output

For each query, output 0 if there is no subsequence b satisfying the constraints mentioned in the legend. You can print the empty line after but that's not mandatory.

Otherwise, output one integer k (k > 2) denoting the length of sequence b, then output k integers i_1, i_2, …, i_k (L ≤ i_1 < i_2<…<i_k≤ R) satisfying that b_j = a_{i_j} for 1 ≤ j ≤ k.

If there are multiple answers with the maximum length, print any of them.

Example

Input


6 2
3 1 4 1 5 9
1 3
4 6


Output


3
1 2 3 
0

Note

For the first query, the given sequence itself is monotone triples free.

For the second query, it can be shown that there is no subsequence b with length greater than 2 such that b is monotone triples free.
#include <bits/stdc++.h>
using namespace std;
const int N = 200200;
const int Inf = 1e9 + 1;
template <typename type>
struct SegmentTreeWithoutLazyPropagation {
 private:
  const type E = pair<int, int>(Inf, Inf);

 private:
  static const int Nax = 4 * N;

 private:
  int n;

 private:
  type Tree[Nax];

 public:
  SegmentTreeWithoutLazyPropagation(int n = 0) : n(n) {
    for (int Node = 0; Node < Nax; Node++) Tree[Node] = E;
  }

 private:
  type Unite(type x, type y) { return min(x, y); }

 private:
  void Merge(int Node) {
    Tree[Node] = Unite(Tree[(Node << 1)], Tree[(Node << 1 | 1)]);
  }

 public:
  void Build(const vector<type>& a) {
    Clear();
    n = a.size();
    Build(a, 1, 0, n - 1);
  }

 private:
  void Build(const vector<type>& a, int Node, int L, int R) {
    Tree[Node] = E;
    if (L == R) return void(Tree[Node] = a[L]);
    Build(a, (Node << 1), L, ((L + R) >> 1));
    Build(a, (Node << 1 | 1), ((L + R) >> 1) + 1, R);
    Merge(Node);
  }

 public:
  void Update(int i, type x) {
    if (n <= 0) return;
    Update(i, x, 1, 0, n - 1);
  }

 private:
  void Update(int i, type x, int Node, int L, int R) {
    if (i < L || R < i) return;
    if (L == R) return void(Tree[Node] = x);
    Update(i, x, (Node << 1), L, ((L + R) >> 1));
    Update(i, x, (Node << 1 | 1), ((L + R) >> 1) + 1, R);
    Merge(Node);
  }

 public:
  type Query(int i, int j) {
    if (n <= 0 || i > j) return E;
    return Query(i, j, 1, 0, n - 1);
  }

 private:
  type Query(int i, int j, int Node, int L, int R) {
    if (j < L || R < i) return E;
    if (i <= L && R <= j) return Tree[Node];
    return Unite(Query(i, j, (Node << 1), L, ((L + R) >> 1)),
                 Query(i, j, (Node << 1 | 1), ((L + R) >> 1) + 1, R));
  }

 public:
  void Clear() {
    for (int Node = 0; Node <= 4 * n; Node++) Tree[Node] = E;
    n = 0;
  }
};
template <typename type>
struct PersistentNonLazySegmentTree {
 private:
  const type E = -Inf;

 private:
  static const int Nax = 100 * N;

 private:
  int n;

 private:
  int Counter;

 private:
  int Left[Nax];

 private:
  int Right[Nax];

 private:
  type Tree[Nax];

 private:
  vector<int> Roots;

 private:
  int NewNode() {
    Tree[Counter] = E;
    Left[Counter] = -1;
    Right[Counter] = -1;
    return Counter++;
  }

 private:
  int NewNode(int Copy) {
    Tree[Counter] = Tree[Copy];
    Left[Counter] = Left[Copy];
    Right[Counter] = Right[Copy];
    return Counter++;
  }

 private:
  type Unite(type x, type y) { return max(x, y); }

 private:
  void Merge(int Node) {
    Tree[Node] = Unite(Tree[Left[Node]], Tree[Right[Node]]);
  }

 public:
  int Build(const vector<type>& a) {
    Clear();
    n = a.size();
    Roots.push_back(NewNode());
    Build(a, Roots[0], 0, n - 1);
    return (int)Roots.size() - 1;
  }

 private:
  void Build(const vector<type>& a, int Node, int L, int R) {
    if (L == R) return void(Tree[Node] = a[L]);
    Build(a, Left[Node] = NewNode(), L, ((L + R) >> 1));
    Build(a, Right[Node] = NewNode(), ((L + R) >> 1) + 1, R);
    Merge(Node);
  }

 public:
  int Update(int i, type x) {
    Roots.push_back(Update(i, x, Roots.back(), 0, n - 1));
    return (int)Roots.size() - 1;
  }

 private:
  int Update(int i, type x, int Node, int L, int R) {
    if (i < L || R < i) return Node;
    Node = NewNode(Node);
    if (i <= L && R <= i) return Tree[Node] = x, Node;
    if (i <= ((L + R) >> 1))
      Left[Node] = Update(i, x, Left[Node], L, ((L + R) >> 1));
    else
      Right[Node] = Update(i, x, Right[Node], ((L + R) >> 1) + 1, R);
    return Merge(Node), Node;
  }

 public:
  type Query(int Version, int L, int R) {
    return Query(L, R, Roots[Version], 0, n - 1);
  }

 private:
  type Query(int i, int j, int Node, int L, int R) {
    if (i > j || L > R) return E;
    if (j < L || R < i) return E;
    if (i <= L && R <= j) return Tree[Node];
    return Unite(Query(i, j, Left[Node], L, ((L + R) >> 1)),
                 Query(i, j, Right[Node], ((L + R) >> 1) + 1, R));
  }

 public:
  int Search(int Version, int L, int R, int x) {
    return Search(L, R, x, Roots[Version], 0, n - 1);
  }

 private:
  int Search(int i, int j, int x, int Node, int L, int R) {
    if (i > j || L > R) return Inf;
    if (j < L || R < i) return Inf;
    if (L == R) return Tree[Node] > x ? L : Inf;
    if (i <= L && R <= j) {
      if (Tree[Left[Node]] > x)
        return Search(i, j, x, Left[Node], L, ((L + R) >> 1));
      if (Tree[Right[Node]] > x)
        return Search(i, j, x, Right[Node], ((L + R) >> 1) + 1, R);
      return Inf;
    }
    return min(Search(i, j, x, Left[Node], L, ((L + R) >> 1)),
               Search(i, j, x, Right[Node], ((L + R) >> 1) + 1, R));
  }

 public:
  void Clear() {
    n = 0;
    Counter = 0;
    Roots.clear();
  }
};
SegmentTreeWithoutLazyPropagation<pair<int, int>> MinDp3Tree;
SegmentTreeWithoutLazyPropagation<pair<int, int>> MinDp4Tree;
PersistentNonLazySegmentTree<int> MaxLastGreaterTree;
PersistentNonLazySegmentTree<int> MaxLastSmallerTree;
int main() {
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  map<int, int> Hash;
  for (int& x : a) scanf("%d", &x), Hash[x];
  Hash[-Inf];
  Hash[+Inf];
  int m = 0;
  for (pair<int, int> p : Hash) Hash[p.first] = m++;
  for (int& x : a) x = Hash[x];
  vector<vector<int>> Have(m);
  for (int i = 0; i < n; i++) Have[a[i]].push_back(i);
  vector<int> NextGreater(n, +Inf);
  vector<int> NextSmaller(n, +Inf);
  vector<int> LastGreater(n, -Inf);
  vector<int> LastSmaller(n, -Inf);
  stack<int> stk;
  for (int i = 0; i < n; i++) {
    while (!stk.empty() && a[stk.top()] < a[i])
      NextGreater[stk.top()] = i, stk.pop();
    stk.push(i);
  }
  while (!stk.empty()) stk.pop();
  for (int i = 0; i < n; i++) {
    while (!stk.empty() && a[stk.top()] > a[i])
      NextSmaller[stk.top()] = i, stk.pop();
    stk.push(i);
  }
  while (!stk.empty()) stk.pop();
  for (int i = n - 1; ~i; --i) {
    while (!stk.empty() && a[i] > a[stk.top()])
      LastGreater[stk.top()] = i, stk.pop();
    stk.push(i);
  }
  while (!stk.empty()) stk.pop();
  for (int i = n - 1; ~i; --i) {
    while (!stk.empty() && a[i] < a[stk.top()])
      LastSmaller[stk.top()] = i, stk.pop();
    stk.push(i);
  }
  while (!stk.empty()) stk.pop();
  vector<int> MaxLastGreaterVersion(
      m, MaxLastGreaterTree.Build(vector<int>(n, -Inf)));
  for (int x = m - 2; x >= 0; x--) {
    MaxLastGreaterVersion[x] = MaxLastGreaterVersion[x + 1];
    for (int i : Have[x])
      MaxLastGreaterVersion[x] = MaxLastGreaterTree.Update(i, LastGreater[i]);
  }
  vector<int> MaxLastSmallerVersion(
      m, MaxLastSmallerTree.Build(vector<int>(n, -Inf)));
  for (int x = 1; x < m; x++) {
    MaxLastSmallerVersion[x] = MaxLastSmallerVersion[x - 1];
    for (int i : Have[x])
      MaxLastSmallerVersion[x] = MaxLastSmallerTree.Update(i, LastSmaller[i]);
  }
  vector<vector<int>> Dp3(n, vector<int>(3, Inf));
  vector<vector<int>> Dp4(n, vector<int>(4, Inf));
  MinDp3Tree.Build(vector<pair<int, int>>(m, pair<int, int>(Inf, Inf)));
  for (int i = n - 1; ~i; --i) {
    pair<int, int> Current = MinDp3Tree.Query(a[i] + 1, m - 1);
    if (Current.first < Dp3[i].back()) {
      Dp3[i][0] = i;
      Dp3[i][1] = Current.second;
      Dp3[i][2] = Current.first;
    }
    MinDp3Tree.Update(a[i], pair<int, int>(NextSmaller[i], i));
  }
  MinDp3Tree.Build(vector<pair<int, int>>(m, pair<int, int>(Inf, Inf)));
  for (int i = n - 1; ~i; --i) {
    pair<int, int> Current = MinDp3Tree.Query(0, a[i] - 1);
    if (Current.first < Dp3[i].back()) {
      Dp3[i][0] = i;
      Dp3[i][1] = Current.second;
      Dp3[i][2] = Current.first;
    }
    MinDp3Tree.Update(a[i], pair<int, int>(NextGreater[i], i));
  }
  for (int i = 0, j; i < n; i++) {
    if ((j = NextSmaller[i]) < n) {
      int k = MaxLastGreaterTree.Search(MaxLastGreaterVersion[a[i]], j + 1,
                                        m - 1, i);
      if (j < k && k < n && k < Dp4[i].back()) {
        Dp4[i][0] = i;
        Dp4[i][1] = min(j, LastGreater[k]);
        Dp4[i][2] = max(j, LastGreater[k]);
        Dp4[i][3] = k;
      }
    }
    if ((j = NextGreater[i]) < n) {
      int k = MaxLastSmallerTree.Search(MaxLastSmallerVersion[a[i]], j + 1,
                                        m - 1, i);
      if (j < k && k < n && k < Dp4[i].back()) {
        Dp4[i][0] = i;
        Dp4[i][1] = min(j, LastSmaller[k]);
        Dp4[i][2] = max(j, LastSmaller[k]);
        Dp4[i][3] = k;
      }
    }
  }
  {
    vector<pair<int, int>> Temp(n);
    for (int i = 0; i < n; i++) Temp[i] = pair<int, int>(Dp3[i].back(), i);
    MinDp3Tree.Build(Temp);
  }
  {
    vector<pair<int, int>> Temp(n);
    for (int i = 0; i < n; i++) Temp[i] = pair<int, int>(Dp4[i].back(), i);
    MinDp4Tree.Build(Temp);
  }
  while (q--) {
    int L, R;
    scanf("%d%d", &L, &R);
    L--, R--;
    pair<int, int> Ans = MinDp4Tree.Query(L, R);
    if (Ans.first <= R) {
      puts("4");
      for (int i : Dp4[Ans.second]) printf("%d ", i + 1);
      puts("");
      continue;
    }
    Ans = MinDp3Tree.Query(L, R);
    if (Ans.first <= R) {
      puts("3");
      for (int i : Dp3[Ans.second]) printf("%d ", i + 1);
      puts("");
      continue;
    }
    puts("0\n");
  }
}
