#include <bits/stdc++.h>
using namespace std;
class seg_min_index {
 public:
  int n, size;
  vector<long long> arr;
  vector<int> hai;
  long long inf;
  seg_min_index(int m) : inf(1LL << 60) {
    n = 1;
    while (n < m) n *= 2;
    size = n * 2;
    arr.resize(n);
    hai.resize(n * 2);
    fill(arr.begin(), arr.end(), inf);
    for (int i = n; i < size; i++) hai[i] = i - n;
    for (int i = n - 1; i > 0; i--) {
      hai[i] =
          arr[hai[2 * i]] < arr[hai[2 * i + 1]] ? hai[2 * i] : hai[2 * i + 1];
    }
  }
  void update(int i, long long v) {
    arr[i] = v;
    i += n;
    while (i > 1) {
      i /= 2;
      hai[i] =
          arr[hai[2 * i]] < arr[hai[2 * i + 1]] ? hai[2 * i] : hai[2 * i + 1];
    }
  }
  int range_min_index(int left, int right) {
    if (left > right) return -1;
    int res = left;
    left += n, right += n;
    for (; left <= right; left = (left + 1) >> 1, right = (right - 1) >> 1) {
      if (left & 1) {
        if (arr[res] > arr[hai[left]]) res = hai[left];
      }
      if ((right & 1) == 0) {
        if (arr[res] > arr[hai[right]]) res = hai[right];
      }
    }
    return res;
  }
};
template <typename T>
vector<int> coordinate_compression(const T &a, int cur = 0) {
  int n = (int)a.size();
  T b = a;
  sort(b.begin(), b.end());
  b.erase(unique(b.begin(), b.end()), b.end());
  vector<int> res(n);
  for (int i = 0; i < n; i++)
    res[i] = (int)(lower_bound(b.begin(), b.end(), a[i]) - b.begin()) + cur;
  return res;
}
vector<vector<int>> sol(vector<int> &a) {
  int n = (int)a.size();
  vector<int> left_up(n);
  vector<int> right_down(n);
  stack<int> st;
  for (int i = 0; i < n; i++) {
    while (st.size() && a[st.top()] <= a[i]) st.pop();
    if (st.size()) {
      left_up[i] = st.top();
    } else {
      left_up[i] = -1;
    }
    st.push(i);
  }
  while (st.size()) st.pop();
  for (int i = n - 1; i >= 0; i--) {
    while (st.size() && a[st.top()] >= a[i]) st.pop();
    if (st.size()) {
      right_down[i] = st.top();
    } else {
      right_down[i] = n;
    }
    st.push(i);
  }
  seg_min_index seg(n + 10);
  vector<vector<int>> ran(n);
  for (int i = 0; i < n; i++) {
    if (right_down[i] == n) continue;
    ran[right_down[i]].push_back(i);
  }
  vector<vector<int>> res(n);
  vector<bool> activated(n);
  for (int i = 0; i < n; i++) {
    int le = 0, ri = left_up[i] - 1;
    if (ri >= 0) {
      while (le < ri) {
        int mid = (le + ri + 1) / 2;
        int v = seg.range_min_index(mid, left_up[i] - 1);
        if (!activated[v] || a[v] > a[i])
          ri = mid - 1;
        else
          le = mid;
      }
      int v = seg.range_min_index(le, left_up[i] - 1);
      if (activated[v] && a[v] <= a[i]) {
        res[i].push_back(v);
        res[i].push_back(right_down[v]);
        res[i].push_back(left_up[i]);
        res[i].push_back(i);
      }
    }
    for (int r : ran[i]) {
      activated[r] = true;
      seg.update(r, a[r]);
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, q;
  cin >> n >> q;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> b = coordinate_compression(a);
  vector<int> c(n);
  for (int i = 0; i < n; i++) {
    c[i] = n - b[i];
  }
  vector<int> left_inc(n);
  vector<int> left_dec(n);
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      left_inc[i] = 1;
      left_dec[i] = 1;
      continue;
    }
    if (a[i] == a[i - 1]) {
      left_inc[i] = left_inc[i - 1] + 1;
      left_dec[i] = left_dec[i - 1] + 1;
    } else if (a[i] > a[i - 1]) {
      left_inc[i] = left_inc[i - 1] + 1;
      left_dec[i] = 1;
    } else {
      left_inc[i] = 1;
      left_dec[i] = left_dec[i - 1] + 1;
    }
  }
  vector<vector<int>> v0 = sol(b);
  vector<vector<int>> v1 = sol(c);
  vector<vector<int>> v2(n);
  for (int i = 0; i < n; i++) {
    if (v0[i].size() && v1[i].size()) {
      if (v0[i][0] > v1[i][0])
        v2[i] = v0[i];
      else
        v2[i] = v1[i];
    } else if (v0[i].size()) {
      v2[i] = v0[i];
    } else if (v1[i].size()) {
      v2[i] = v1[i];
    }
    sort(v2[i].begin(), v2[i].end());
  }
  int maxind = 0;
  for (int i = 0; i < n; i++) {
    if (v2[i].size()) {
      if (v2[maxind].size() == 0 || v2[maxind][0] < v2[i][0]) maxind = i;
    }
    v2[i] = v2[maxind];
  }
  for (int i = 0; i < q; i++) {
    int le, ri;
    cin >> le >> ri;
    le--, ri--;
    int mono_len = max(left_inc[ri], left_dec[ri]);
    if (mono_len >= (ri - le + 1)) {
      cout << 0 << "\n";
      cout << "\n";
      continue;
    }
    if (v2[ri].size() && v2[ri][0] >= le) {
      cout << 4 << "\n";
      for (int j = 0; j < 4; j++) {
        cout << v2[ri][j] + 1 << " ";
      }
      cout << "\n";
      continue;
    }
    cout << 3 << "\n";
    cout << (ri - mono_len + 1) << " " << (ri - mono_len + 2) << " " << (ri + 1)
         << "\n";
  }
  return 0;
}
