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 MAXN = 200000;
pair<int, int> t[4 * MAXN];
int tt[4 * MAXN];
int fs[MAXN];
int numbers[MAXN];
int n_occ[MAXN];
int no_occ[MAXN];
int log_inc[MAXN];
int log_dec[MAXN];
int eq_strk1[MAXN];
int eq_strk2[MAXN];
void build1(int v, int tl, int tr) {
  if (tl == tr) {
    tt[v] = tl;
  } else {
    int tm = (tl + tr) / 2;
    build1(v * 2, tl, tm);
    build1(v * 2 + 1, tm + 1, tr);
    if (fs[tt[v * 2]] > fs[tt[v * 2 + 1]]) {
      tt[v] = tt[v * 2];
    } else {
      tt[v] = tt[v * 2 + 1];
    }
  }
}
int mini(int v, int tl, int tr, int l, int r) {
  if (l > r) return -1;
  if (l == tl && r == tr) {
    return tt[v];
  }
  int tm = (tl + tr) / 2;
  int a = mini(v * 2, tl, tm, l, min(r, tm));
  int b = mini(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r);
  if (a == -1 && b == -1) {
    return -1;
  } else if (a == -1) {
    return b;
  } else if (b == -1) {
    return a;
  } else {
    if (fs[a] > fs[b]) {
      return a;
    } else {
      return b;
    }
  }
}
void build(int v, int tl, int tr) {
  if (tl == tr) {
    t[v] = make_pair(tl, tl);
  } else {
    int tm = (tl + tr) / 2;
    build(v * 2, tl, tm);
    build(v * 2 + 1, tm + 1, tr);
    if (numbers[t[v * 2].first] < numbers[t[v * 2 + 1].first]) {
      t[v].first = t[v * 2].first;
    } else {
      t[v].first = t[v * 2 + 1].first;
    }
    if (numbers[t[v * 2].second] > numbers[t[v * 2 + 1].second]) {
      t[v].second = t[v * 2].second;
    } else {
      t[v].second = t[v * 2 + 1].second;
    }
  }
}
pair<int, int> mini_max(int v, int tl, int tr, int l, int r) {
  if (l > r) return make_pair(-1, -1);
  if (l == tl && r == tr) {
    return t[v];
  }
  int tm = (tl + tr) / 2;
  pair<int, int> a = mini_max(v * 2, tl, tm, l, min(r, tm));
  pair<int, int> b = mini_max(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r);
  pair<int, int> w;
  if (a.first == -1 && b.first == -1) {
    w.first = -1;
  } else if (a.first == -1) {
    w.first = b.first;
  } else if (b.first == -1) {
    w.first = a.first;
  } else {
    if (numbers[a.first] < numbers[b.first]) {
      w.first = a.first;
    } else {
      w.first = b.first;
    }
  }
  if (a.second == -1 && b.second == -1) {
    w.second = -1;
  } else if (a.second == -1) {
    w.second = b.second;
  } else if (b.second == -1) {
    w.second = a.second;
  } else {
    if (numbers[a.second] > numbers[b.second]) {
      w.second = a.second;
    } else {
      w.second = b.second;
    }
  }
  return w;
}
int getSum(int BITree[], int index) {
  int sum = 0;
  index = index + 1;
  while (index > 0) {
    sum += BITree[index];
    index -= index & (-index);
  }
  return sum;
}
void updateBIT(int BITree[], int n, int index, int val) {
  index = index + 1;
  while (index <= n) {
    BITree[index] += val;
    index += index & (-index);
  }
}
int *constructBITree(int arr[], int n) {
  int *BITree = new int[n + 1];
  for (int i = 1; i <= n; i++) BITree[i] = 0;
  for (int i = 0; i < n; i++) updateBIT(BITree, n, i, arr[i]);
  return BITree;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, q;
  cin >> n >> q;
  for (int j = 0; j < n; j++) {
    cin >> numbers[j];
  }
  build(1, 0, n - 1);
  int *BITree = constructBITree(no_occ, n);
  vector<int> s1;
  vector<int> s2;
  for (int j = 0; j < n; j++) {
    fs[j] = -1;
  }
  log_inc[0] = 1;
  log_dec[0] = 1;
  for (int j = 1; j < n; j++) {
    if (numbers[j] >= numbers[j - 1]) {
      log_inc[j] = log_inc[j - 1] + 1;
    } else {
      log_inc[j] = 1;
    }
  }
  eq_strk2[0] = 1;
  eq_strk1[0] = 1;
  for (int j = 1; j < n; j++) {
    if (numbers[j] <= numbers[j - 1]) {
      log_dec[j] = log_dec[j - 1] + 1;
    } else {
      log_dec[j] = 1;
    }
  }
  for (int j = 0; j < n; j++) {
    while (s1.size() > 0) {
      int a = s1[s1.size() - 1];
      if (numbers[a] >= numbers[j]) {
        break;
      }
      s1.pop_back();
      n_occ[a]++;
      if (n_occ[a] == 2) {
        no_occ[a] = 1;
        updateBIT(BITree, n, a, 1);
      }
    }
    while (s2.size() > 0) {
      int a = s2[s2.size() - 1];
      if (numbers[a] <= numbers[j]) {
        break;
      }
      s2.pop_back();
      n_occ[a]++;
      if (n_occ[a] == 2) {
        no_occ[a] = 1;
        updateBIT(BITree, n, a, 1);
      }
    }
    s1.push_back(j);
    if (s1.size() > 1) {
      if (numbers[s1[s1.size() - 1]] == numbers[s1[s1.size() - 2]]) {
        eq_strk1[j] = eq_strk1[s1[s1.size() - 2]] + 1;
      } else {
        eq_strk1[j] = 1;
      }
    } else {
      eq_strk1[j] = 1;
    }
    s2.push_back(j);
    if (s2.size() > 1) {
      if (numbers[s2[s2.size() - 1]] == numbers[s2[s2.size() - 2]]) {
        eq_strk2[j] = eq_strk2[s2[s2.size() - 2]] + 1;
      } else {
        eq_strk2[j] = 1;
      }
    } else {
      eq_strk2[j] = 1;
    }
    if (s1.size() > eq_strk1[j] && s2.size() > eq_strk2[j]) {
      if (min(s1[s1.size() - eq_strk1[j] - 1],
              s2[s2.size() - eq_strk2[j] - 1]) > 0) {
        int ind = min(s1[s1.size() - eq_strk1[j] - 1],
                      s2[s2.size() - eq_strk2[j] - 1]) -
                  1;
        int cc = getSum(BITree, ind);
        if (cc > 0) {
          int rg;
          if (ind == 0) {
            rg = ind;
          } else {
            int cd = getSum(BITree, ind - 1);
            if (cc - cd > 0) {
              rg = ind;
            } else {
              int cd = getSum(BITree, 0);
              if (cc - cd == 0) {
                rg = 0;
              } else {
                int start = 0;
                int fin = ind - 1;
                while (fin - start > 1) {
                  int mid = (fin + start) / 2;
                  int get_mid = getSum(BITree, mid);
                  if (cc - get_mid > 0) {
                    start = mid;
                  } else {
                    fin = mid;
                  }
                }
                rg = fin;
              }
            }
          }
          fs[j] = rg;
        } else {
          fs[j] = -1;
        }
      } else {
        fs[j] = -1;
      }
    } else {
      fs[j] = -1;
    }
  }
  build1(1, 0, n - 1);
  for (int j = 0; j < q; j++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    int c = mini(1, 0, n - 1, a, b);
    if (fs[c] >= 0 && fs[c] >= a && fs[c] <= b) {
      vector<int> numm(4);
      pair<int, int> upd = mini_max(1, 0, n - 1, fs[c] + 1, c - 1);
      numm[0] = c;
      numm[1] = fs[c];
      numm[2] = upd.first;
      numm[3] = upd.second;
      sort(numm.begin(), numm.end());
      cout << 4 << endl;
      for (int i = 0; i < 4; i++) {
        cout << numm[i] + 1 << " ";
      }
      cout << endl;
    } else {
      int m1 = log_inc[b];
      int m2 = log_dec[b];
      if (b - a + 1 <= m1 || b - a + 1 <= m2) {
        cout << 0 << endl;
      } else {
        if (m1 > m2) {
          int p = b - m2 + 1;
          int pp = b - m1 + 1;
          int ppp = pp - 1;
          cout << 3 << endl;
          cout << ppp + 1 << " " << pp + 1 << " " << p + 1 << endl;
        } else {
          int p = b - m1 + 1;
          int pp = b - m2 + 1;
          int ppp = pp - 1;
          cout << 3 << endl;
          cout << ppp + 1 << " " << pp + 1 << " " << p + 1 << endl;
        }
      }
    }
  }
  return 0;
}
