/**
 * DA-IICT
 * Author : PARTH PATEL
 */
import java.io.*;
import java.math.*;
import java.util.*;

import static java.util.Arrays.fill;
import static java.lang.Math.*;
import static java.util.Arrays.sort;
import static java.util.Collections.sort;


 class MKTHNUM {

	public static long mod = 1000000007;
	public static long INF = (1L << 60);
	static FastScanner2 in = new FastScanner2();
	static OutputWriter out = new OutputWriter(System.out);
	static int n,m;
	static int[] arr;
	static ArrayList<Integer>[] tree;
	public static void buildtree(int node,int start,int end)
	{
		if(start==end)
		{
			tree[node].add(arr[start]);
			return;
		}
		int mid=(start+end)/2;
		buildtree(2*node, start, mid);
		buildtree(2*node+1, mid+1, end);
		tree[node]=merge(tree[2*node], tree[2*node+1]);
	}
	public static int querytree(int node,int start,int end,int l,int r,int k)
	{
		if(r<start || end<l)
		{
			return 0;
		}
		if(l<=start && end<=r)
		{
			if(l==r)
			{
				if(arr[start]>k)
					return 0;
				return 1;
			}
			int low=0;
			int high=tree[node].size()-1;
			// binary search returns number of elements smaller than or equal to k in given list
			while(low<=high)
			{
				int mid=(low+high)/2;
				if(tree[node].get(mid)>k)
				{
					high=mid-1;
				}
				else
				{
					low=mid+1;
				}
			}
			return low;
		}
		int mid=(start+end)/2;
		int p1=querytree(2*node, start, mid, l, r, k);
		int p2=querytree(2*node+1, mid+1, end, l, r, k);
		return (p1+p2);
	}
	public static ArrayList<Integer> merge(ArrayList<Integer> list1, ArrayList<Integer> list2)
	{
		ArrayList<Integer> merged=new ArrayList<>();
		int i=0;
		int j=0;
		while(i<list1.size() && j<list2.size())
		{
			if(list1.get(i)>list2.get(j))
			{
				merged.add(list2.get(j));
				j++;
			}
			else
			{
				merged.add(list1.get(i));
				i++;
			}
		}
		while(i<list1.size())
		{
			merged.add(list1.get(i));
			i++;
		}
		while(j<list2.size())
		{
			merged.add(list2.get(j));
			j++;
		}
		return merged;
	}
	public static void main(String[] args) {

		n=in.nextInt();
		tree=new ArrayList[4*n+1000];
		for(int i=0;i<4*n+1000;i++)
		{
			tree[i]=new ArrayList<>();
		}
		m=in.nextInt();
		arr=new int[n];
		for(int i=0;i<n;i++)
		{
			arr[i]=in.nextInt();
		}
		buildtree(1, 0, n-1);
		while(m-->0)
		{
			int l=in.nextInt();
			int r=in.nextInt();
			int k=in.nextInt(); // obtain k-th number in this sorted segment
			long low=(int) -1e9;
			long high=(int)1e9;
			int answer = 0;
			if(l==r)
			{
				out.println(arr[l-1]);
				continue;
			}
			while(low<=high)
			{
				long mid=(low+high)/2;
				int query=querytree(1, 0, n-1, l-1, r-1, (int)mid);

				if(query==k)
				{
					answer=(int) mid;
					break;
				}
				if(query>k)
				{
					high=mid-1;
				}
				if(query<k)
				{
					low=mid+1;
				}
			}
			out.println(answer);
		}
		out.close();

	}

	public static long pow(long x, long n, long mod) {
		long res = 1;
		for (long p = x; n > 0; n >>= 1, p = (p * p) % mod) {
			if ((n & 1) != 0) {
				res = (res * p % mod);
			}
		}
		return res;
	}

	public static long gcd(long n1, long n2) {
		long r;
		while (n2 != 0) {
			r = n1 % n2;
			n1 = n2;
			n2 = r;
		}
		return n1;
	}

	public static long lcm(long n1, long n2) {
		long answer = (n1 * n2) / (gcd(n1, n2));
		return answer;
	}

	static class FastScanner2 {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;

		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n) {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLong();
			}
			return arr;
		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine() {
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine = reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		public long[] nextLongArray(int n) {
			long a[] = new long[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextLong();
			}
			return a;
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}
	}

	static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void println(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}

		public void flush() {
			writer.flush();
		}
	}

}
