import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
	static final int INF = (int) (1e9 + 10);
	static final int MOD = (int) (1e9 + 7);

	// static final int N = (int) (4e5 + 5);
	// static ArrayList<Integer>[] graph;
	// static boolean visited[];
	// static long size[];

	public static void main(String[] args) throws NumberFormatException, IOException {
		FastReader sc = new FastReader();
		PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = sc.nextInt();
		while (t-- > 0) {
			int n = sc.nextInt();
		  //  int x = sc.nextInt();
		    int [] arr = new int[n];
		    long sum =0;
		  //  TreeSet<Integer> ts = new TreeSet<>();
		    for(int i =0 ; i < n; i++){
		        arr[i] = sc.nextInt();
		      //  ts.add(arr[i]);
		        sum += arr[i];
		    }
            ArrayList<String> list = new ArrayList<>();
            long curr =0;
            for(int i =0 ; i < n ; i++){
                curr += arr[i];
                long pre = ((i+1)*(i+2))/2;
                long suff = ((n-i-1)*(n-i))/2;
                if(curr == pre && (sum-curr) == suff){
                    list.add(Integer.toString(i+1) + " " + Integer.toString(n-1-i));
                }
            }
            pr.println(list.size());
            for(String s : list){
                pr.println(s);
            }

		}

		pr.flush();
		pr.close();
	}

	/*
	 * Template From Here
	 */

	public static int lowerBound(ArrayList<Integer> array, int length, long value) {
		int low = 0;
		int high = length;
		while (low < high) {
			final int mid = (low + high) / 2;
			if (value <= array.get(mid)) {
				high = mid;
			} else {
				low = mid + 1;
			}
		}
		return low;
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	static long gcd(long a, long b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	static long lcm(long a, long b) {
		return (a * b) / gcd(a, b);
	}

	public static void sortbyColumn(int[][] att, int col) {
		// Using built-in sort function Arrays.sort
		Arrays.sort(att, new Comparator<int[]>() {

			@Override
			// Compare values according to columns
			public int compare(final int[] entry1, final int[] entry2) {

				// To sort in descending order revert
				// the '>' Operator
				// if (entry1[col] > entry2[col])
				// return 1;
				// else //(entry1[col] >= entry2[col])
				// return -1;
				return new Integer(entry1[col]).compareTo(entry2[col]);
				// return entry1[col].
			}
		}); // End of function call sort().
	}

	static class pair {
		int V, I;

		pair(int v, int i) {
			V = v;
			I = i;
		}
	}

	public static int[] swap(int data[], int left, int right) {
		int temp = data[left];
		data[left] = data[right];
		data[right] = temp;
		return data;
	}

	public static int[] reverse(int data[], int left, int right) {
		while (left < right) {
			int temp = data[left];
			data[left++] = data[right];
			data[right--] = temp;
		}
		return data;
	}

	public static boolean findNextPermutation(int data[]) {
		if (data.length <= 1)
			return false;

		int last = data.length - 2;
		while (last >= 0) {
			if (data[last] < data[last + 1]) {
				break;
			}
			last--;
		}
		if (last < 0)
			return false;

		int nextGreater = data.length - 1;
		for (int i = data.length - 1; i > last; i--) {
			if (data[i] > data[last]) {
				nextGreater = i;
				break;
			}
		}
		data = swap(data, nextGreater, last);
		data = reverse(data, last + 1, data.length - 1);
		return true;
	}

	static long nCr(long n, long r) {
		if (n == r)
			return 1;
		return fact(n) / (fact(r) * fact(n - r));
	}

	static long fact(long n) {
		long res = 1;
		for (long i = 2; i <= n; i++)
			res = res * i;
		return res;
	}

	/*
	 * static boolean prime[] = new boolean[1000007];
	 *
	 * public static void sieveOfEratosthenes(int n) {
	 *
	 * for (int i = 0; i < n; i++) prime[i] = true; * for (int p = 2; p * p <=
	 * n; p++) { // If prime[p] is not changed, then it is a prime if (prime[p]
	 * == true) { // Update all multiples of p for (int i = p * p; i <= n; i +=
	 * p) prime[i] = false; } }
	 *
	 * // Print all prime numbers // for(int i = 2; i <= n; i++) // { //
	 * if(prime[i] == true) // System.out.print(i + " "); // } }
	 */

	static long power(long fac2, int y, int p) {
		long res = 1;
		fac2 = fac2 % p;
		while (y > 0) {
			if (y % 2 == 1)
				res = (res * fac2) % p;
			fac2 = (fac2 * fac2) % p;
		}
		return res;
	}

	static long modInverse(long fac2, int p) {
		return power(fac2, p - 2, p);
	}

	static boolean isPrime(int n) {
		// Corner cases
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		// This is checked so that we can skip
		// middle five numbers in below loop
		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}

	public static BigInteger lcmm(String a, String b) {
		BigInteger s = new BigInteger(a);
		BigInteger s1 = new BigInteger(b);
		BigInteger mul = s.multiply(s1);
		BigInteger gcd = s.gcd(s1);
		BigInteger lcm = mul.divide(gcd);
		return lcm;
	}

}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main {

	static long sx = 0, sy = 0, mod = (long) (1e9 + 7);

	static ArrayList<Integer>[] a;
	static long[][][] dp;
	static int[] size;
	static long[] farr;
	public static PrintWriter out;
	static ArrayList<pair> pa = new ArrayList<>();
	static long[] fact = new long[(int) 1e6];
	static boolean b = false;
	static StringBuilder sb = new StringBuilder();
	static boolean cycle = false;
	// static long m = 998244353;
	static long[] no, col;
	static String s;
	static int k = 0, n = 0, m = 0;
	static int[] c;
	static long ans = 0;
	static long[][] p;
	static HashMap<Integer, Integer> hm;

	public static void main(String[] args) throws IOException {

		Scanner scn = new Scanner(new BufferedReader(new InputStreamReader(System.in)));

		out = new PrintWriter(System.out);
		// Reader scn = new Reader();

		int t = scn.nextInt();

		while (t-- != 0) {

			int n = scn.nextInt();

			int[] a = new int[n + 1];

			for (int i = 1; i <= n; i++)
				a[i] = scn.nextInt();

			int[] lmin = new int[n + 1];
			int[] lmax = new int[n + 1];
			int[] rmin = new int[n + 1];
			int[] rmax = new int[n + 1];

			boolean[] b1 = new boolean[n + 1];
			Arrays.fill(b1, true);
			boolean[] b2 = new boolean[n + 1];
			Arrays.fill(b2, true);
			HashSet<Integer> hm = new HashSet<>();

			lmin[1] = lmax[1] = a[1];

			rmin[n] = rmax[n] = a[n];

			hm.add(a[1]);

			for (int i = 2; i <= n; i++) {

				if (hm.contains(a[i]))
					b1[i] = false;

				b1[i] &= b1[i - 1];

				lmin[i] = Math.min(a[i], lmin[i - 1]);
				lmax[i] = Math.max(a[i], lmax[i - 1]);

				hm.add(a[i]);
			}

			hm = new HashSet<>();
			hm.add(a[n]);

			for (int i = n - 1; i >= 1; i--) {

				if (hm.contains(a[i]))
					b2[i] = false;

				b2[i] &= b2[i + 1];

				rmin[i] = Math.min(rmin[i + 1], a[i]);
				rmax[i] = Math.max(rmax[i + 1], a[i]);

				hm.add(a[i]);
			}

			int ans = 0;

			StringBuilder sb = new StringBuilder();

			for (int i = 1; i <= n - 1; i++) {

				if (lmin[i] == 1 && lmax[i] == i && rmin[i + 1] == 1 && rmax[i + 1] == n - i && b1[i] && b2[i+1]) {
					ans++;
					sb.append(i + " " + (n - i));
					sb.append("\n");
				}

				hm.add(a[i]);
			}

			System.out.println(ans);
			System.out.print(sb);

		}
	}

	// _________________________TEMPLATE_____________________________________________________________

	// public static long lcm(long x, long y) {
	//
	// return (x * y) / gcd(x, y);
	// }
	//
	// private static long gcd(long x, long y) {
	// if (x == 0)
	// return y;
	//
	// return gcd(y % x, x);
	// }

	// static class comp implements Comparator<Integer> {
	//
	// @Override
	// public int compare(Integer o1, Integer o2) {
	// return depth[o2] - depth[o1];
	// }
	//
	// }

	// public static long pow(long a, long b) {
	//
	// if (b < 0)
	// return 0;
	// if (b == 0 || b == 1)
	// return (long) Math.pow(a, b);
	//
	// if (b % 2 == 0) {
	//
	// long ret = pow(a, b / 2);
	// ret = (ret % mod * ret % mod) % mod;
	// return ret;
	// }
	//
	// else {
	// return ((pow(a, b - 1) % mod) * a % mod) % mod;
	// }
	// }

	private static class pair implements Comparable<pair> {

		int w, h;
		int idx;

		pair(int a, int b, int i) {

			w = a;
			h = b;
			idx = i;
		}

		@Override
		public int compareTo(pair o) {

			if (this.w != o.w)
				return this.w - o.w;

			else
				return this.h - o.h;
		}

	}

	private static String reverse(String s) {

		return new StringBuilder(s).reverse().toString();
	}

	public static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException {
			byte[] buf = new byte[1000000 + 1]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}

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

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

		public int[][] nextInt2DArray(int m, int n) throws IOException {
			int[][] arr = new int[m][n];
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < n; j++)
					arr[i][j] = nextInt();
			}
			return arr;
		}

		public long[][] nextInt2DArrayL(int m, int n) throws IOException {
			long[][] arr = new long[m][n];
			for (int i = 0; i < m; i++) {
				for (int j = 0; j < n; j++)
					arr[i][j] = nextInt();
			}
			return arr;
		}
		// kickstart - Solution
		// atcoder - Main
	}

}


/*
 *created by Kraken on 03-04-2020 at 19:59
 */
//package com.kraken.cf.cf631;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int t = sc.nextInt();
		while (t-- > 0) {
			int n = sc.nextInt();
			int[] a = new int[n];
			int max = Integer.MIN_VALUE;
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				max = Math.max(max, a[i]);
			}
			// l1 = max, l2 = n - l1
			int[] x = new int[n];
			for (int i = 0; i < n; i++) x[i] = a[i];
			Arrays.sort(x, 0, max);
			Arrays.sort(x, max, n);
//			System.out.println(Arrays.toString(x));
			boolean fine1 = true;
			for (int i = 0; i < max; i++) {
				if (i == 0 && x[0] != 1) fine1 = false;
				if (i > 0 && x[i] - 1 != x[i - 1]) fine1 = false;
			}
			for (int i = max; i < n; i++) {
				if (i == max && x[i] != 1) fine1 = false;
				if (i > max && x[i] - 1 != x[i - 1]) fine1 =false;
			}
			StringBuilder sb = new StringBuilder();
			if (fine1) {
				sb.append(max + " " + (n - max) + "\n");
			}

			if (max != n - max) {
				// l1 = n - max, l2 = max
				for (int i = 0; i < n; i++)
					x[i] = a[i];
				Arrays.sort(x, 0, n - max);
				Arrays.sort(x, n - max, n);
				//			System.out.println(Arrays.toString(x));
				boolean fine2 = true;
				for (int i = 0; i < n - max; i++) {
					if (i == 0 && x[i] != 1)
						fine2 = false;
					if (i > 0 && x[i] - 1 != x[i - 1])
						fine2 = false;
				}
				for (int i = n - max; i < n; i++) {
					if (i == n - max && x[i] != 1)
						fine2 = false;
					if (i > n - max && x[i] - 1 != x[i - 1])
						fine2 = false;
				}
				if (fine2) {
					sb.append((n - max) + " " + max + "\n");
				}

				if (fine1 && fine2) {
					System.out.println(2);
					System.out.print(sb.toString());
				} else if (fine1 || fine2) {
					System.out.println(1);
					System.out.print(sb.toString());
				} else {
					System.out.println(0);
				}
			} else {
				if (fine1) {
					System.out.println(1);
					System.out.print(sb.toString());
				} else {
					System.out.println(0);
				}
			}
		}
	}

	static class FastReader {

		BufferedReader br;

		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


/*
 *created by Kraken on 03-04-2020 at 19:59
 */
//package com.kraken.cf.cf631;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int t = sc.nextInt();
		while (t-- > 0) {
			int n = sc.nextInt();
			int[] a = new int[n];
			int max = Integer.MIN_VALUE;
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				max = Math.max(max, a[i]);
			}
			// l1 = max, l2 = n - l1
			int[] x = new int[n];
			for (int i = 0; i < n; i++) x[i] = a[i];
			Arrays.sort(x, 0, max);
			Arrays.sort(x, max, n);
//			System.out.println(Arrays.toString(x));
			boolean fine1 = true;
			for (int i = 0; i < max; i++) {
				if (i == 0 && x[0] != 1) fine1 = false;
				if (i > 0 && x[i] - 1 != x[i - 1]) fine1 = false;
			}
			for (int i = max; i < n; i++) {
				if (i == max && x[0] != 1) fine1 = false;
				if (i > max && x[i] - 1 != x[i - 1]) fine1 =false;
			}
			StringBuilder sb = new StringBuilder();
			if (fine1) {
				sb.append(max + " " + (n - max) + "\n");
			}

			// l1 = n - max, l2 = max
			for (int i = 0; i < n; i++) x[i] = a[i];
			Arrays.sort(x, 0, n - max);
			Arrays.sort(x, n - max, n);
//			System.out.println(Arrays.toString(x));
			boolean fine2 = true;
			for (int i = 0; i < n - max; i++) {
				if (i == 0 && x[i] != 1) fine2 = false;
				if (i > 0 && x[i] - 1 != x[i - 1]) fine2 = false;
			}
			for (int i = n - max; i < n; i++) {
				if (i == n - max && x[i] != 1) fine2 = false;
				if (i > n - max && x[i] - 1 != x[i - 1]) fine2 = false;
			}
			if (fine2) {
				sb.append((n - max) + " " + max + "\n");
			}

			if (fine1 && fine2) {
				System.out.println(2);
				System.out.print(sb.toString());
			} else if (fine1 || fine2) {
				System.out.println(1);
				System.out.print(sb.toString());
			} else {
				System.out.println(0);
			}
		}
	}

	static class FastReader {

		BufferedReader br;

		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


/*
 *created by Kraken on 03-04-2020 at 19:59
 */
//package com.kraken.cf.cf631;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {

	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int t = sc.nextInt();
		while (t-- > 0) {
			int n = sc.nextInt();
			int[] a = new int[n];
			int max = Integer.MIN_VALUE;
			for (int i = 0; i < n; i++) {
				a[i] = sc.nextInt();
				max = Math.max(max, a[i]);
			}
			// l1 = max, l2 = n - l1
			int[] x = new int[n];
			for (int i = 0; i < n; i++) x[i] = a[i];
			Arrays.sort(x, 0, max);
			Arrays.sort(x, max, n);
//			System.out.println(Arrays.toString(x));
			boolean fine1 = true;
			for (int i = 0; i < max; i++) {
				if (i == 0 && x[0] != 1) fine1 = false;
				if (i > 0 && x[i] - 1 != x[i - 1]) fine1 = false;
			}
			for (int i = max; i < n; i++) {
				if (i == max && x[i] != 1) fine1 = false;
				if (i > max && x[i] - 1 != x[i - 1]) fine1 =false;
			}
			StringBuilder sb = new StringBuilder();
			if (fine1) {
				sb.append(max + " " + (n - max) + "\n");
			}

			// l1 = n - max, l2 = max
			for (int i = 0; i < n; i++) x[i] = a[i];
			Arrays.sort(x, 0, n - max);
			Arrays.sort(x, n - max, n);
//			System.out.println(Arrays.toString(x));
			boolean fine2 = true;
			for (int i = 0; i < n - max; i++) {
				if (i == 0 && x[i] != 1) fine2 = false;
				if (i > 0 && x[i] - 1 != x[i - 1]) fine2 = false;
			}
			for (int i = n - max; i < n; i++) {
				if (i == n - max && x[i] != 1) fine2 = false;
				if (i > n - max && x[i] - 1 != x[i - 1]) fine2 = false;
			}
			if (fine2) {
				sb.append((n - max) + " " + max + "\n");
			}

			if (fine1 && fine2) {
				System.out.println(2);
				System.out.print(sb.toString());
			} else if (fine1 || fine2) {
				System.out.println(1);
				System.out.print(sb.toString());
			} else {
				System.out.println(0);
			}
		}
	}

	static class FastReader {

		BufferedReader br;

		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			}
			catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


import java.util.*;
import java.io.*;

public class cf1330_Div2_B{

  public static void main(String[] args){
	  FastScanner in = new FastScanner();

	  int t = in.nextInt();

	  for ( ; t > 0; --t) {
		 int n = in.nextInt();
		 int[] arr = new int[n];
		 TreeSet<Integer> map = new TreeSet<Integer>();
		 int max = 0;
		 int[] cnt = new int[n + 1];
		 boolean x = false;
		 for (int i = 0; i < n; i++) {
			 arr[i] = in.nextInt();
			 cnt[arr[i]]++;
			 if (cnt[arr[i]] > 2) {
				 x = true;
				 break;
			 }
			 if (arr[i] > max)
				 max = arr[i];
		 }
		 if (x) {
			 System.out.println(0);
			 continue;
		 }
		 int solns = 0;
		 boolean flag = false;
		 int c = max;
		 for (int i = 0; i < n; i++) {
			 // System.out.println(arr[i]);
			 if (!map.contains(arr[i])) {
				 c--;
				 map.add(arr[i]);
			 }
			 else {
				 break;
			 }
			 if (c == 0) {
				 flag = true;
				 break;
			 }
		 }
		 StringBuilder str = new StringBuilder();
		 if (flag) {
			 solns++;
			 str.append((max) + " " + (n - max) + "\n");
		 }
		 map = new TreeSet<Integer>();
		 flag = false;
		 c = max;
		 for (int i = n - 1; i >= 0; i--) {
			 if (!map.contains(arr[i])) {
				 c--;
				 map.add(arr[i]);
			 }
			 else {
				 break;
			 }
			 if (c == 0) {
				 flag = true;
				 break;
			 }
		 }
		 if (flag) {
			 solns++;
			 str.append((n - max) + " " + max + "\n");
		 }
		 if (solns > 0) {
			 System.out.println(solns);
			 System.out.print(str.toString());
		 }
		 else
			 System.out.println(0);

	  }
  }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

        String next() {
    		while (st == null || !st.hasMoreElements()) {
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e) {
    				e.printStackTrace();
    			}
    		}
    		return st.nextToken();
    	}

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


import java.util.*;
import java.io.*;

public class cf1330_Div2_B{

  public static void main(String[] args){
	  FastScanner in = new FastScanner();

	  int t = in.nextInt();

	  for ( ; t > 0; --t) {
		 int n = in.nextInt();
		 int[] arr = new int[n];

		 TreeSet<Integer> map = new TreeSet<Integer>();
		 int max = 0;
		 boolean x = false;
		 for (int i = 0; i < n; i++) {
			 arr[i] = in.nextInt();
			 if (arr[i] > max)
				 max = arr[i];
		 }
		 int[] cnt = new int[max + 1];
		 for (int i = 0; i < n; i++) {
			 cnt[arr[i]]++;
			 if (cnt[arr[i]] > 2) {
				 x = true;
				 break;
			 }
		 }
		 if (x) {
			 System.out.println(0);
			 continue;
		 }

		 int solns = 0;
		 boolean flag = false;
		 int c = max;
		 for (int i = 0; i < n; i++) {
			 // System.out.println(arr[i]);
			 if (!map.contains(arr[i])) {
				 c--;
				 map.add(arr[i]);
			 }
			 else {
				 break;
			 }
			 if (c == 0) {
				 flag = true;
				 break;
			 }
		 }
		 StringBuilder str = new StringBuilder();
		 if (flag) {
			 solns++;
			 str.append((max) + " " + (n - max) + "\n");
		 }

		 map = new TreeSet<Integer>();
		 flag = false;
		 c = max;
		 for (int i = n - 1; i >= 0; i--) {
			 if (!map.contains(arr[i])) {
				 c--;
				 map.add(arr[i]);
			 }
			 else {
				 break;
			 }
			 if (c == 0) {
				 flag = true;
				 break;
			 }
		 }
		 if (flag) {
			 solns++;
			 str.append((n - max) + " " + max + "\n");
		 }

		 if (solns > 0) {
			 System.out.println(solns);
			 System.out.print(str.toString());
		 }
		 else
			 System.out.println(0);

	  }
  }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

        String next() {
    		while (st == null || !st.hasMoreElements()) {
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e) {
    				e.printStackTrace();
    			}
    		}
    		return st.nextToken();
    	}

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


import java.util.*;
import java.io.*;

public class cf1330_Div2_B{

  public static void main(String[] args){
	  FastScanner in = new FastScanner();

	  int t = in.nextInt();

	  for ( ; t > 0; --t) {
		 int n = in.nextInt();
		 int[] arr = new int[n];
		 int l1 = 0;
		 int l2 = 0;
		 for (int i = 0; i < n; i++) {
			 arr[i] = in.nextInt();
			 if (arr[i] > l2)
				 l2 = arr[i];
		 }
		 l1 = n - l2;

		 boolean flag = false;
		 int[] cnt = new int[l2 + 1];
		 for (int i = 0; i < n; i++) {
			 cnt[arr[i]]++;
			 if (cnt[arr[i]] > 2) {
				flag = true;
				break;
			 }
		 }

		 for (int i = 1; i <= l2 && !flag; i++) {
			 if (i <= l1 && cnt[i] < 2) {
				 flag = true;
				 break;
			 }
			 else if (i > l1 && cnt[i] > 1) {
				 flag = true;
				 break;
			 }
		 }

		 if (flag) {
			 System.out.println(0);
			 continue;
		 }

		 TreeSet<Integer> map = new TreeSet<Integer>();
		 int solns = 0;
		 int c = l2;
		 flag = false;
		 for (int i = 0; i < n; i++) {
			 // System.out.println(arr[i]);
			 if (!map.contains(arr[i])) {
				 c--;
				 map.add(arr[i]);
			 }
			 else {
				 break;
			 }
			 if (c == 0) {
				 flag = true;
				 break;
			 }
		 }
		 StringBuilder str = new StringBuilder();
		 if (flag) {
			 solns++;
			 str.append((l2) + " " + (l1) + "\n");
		 }

		 map = new TreeSet<Integer>();
		 flag = false;
		 c = l2;
		 for (int i = n - 1; i >= 0; i--) {
			 if (!map.contains(arr[i])) {
				 c--;
				 map.add(arr[i]);
			 }
			 else {
				 break;
			 }
			 if (c == 0) {
				 flag = true;
				 break;
			 }
		 }
		 if (flag) {
			 solns++;
			 str.append((l1) + " " + l2 + "\n");
		 }

		 if (solns > 0) {
			 System.out.println(solns);
			 System.out.print(str);
		 }
		 else
			 System.out.println(0);
	  }
  }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

        String next() {
    		while (st == null || !st.hasMoreElements()) {
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e) {
    				e.printStackTrace();
    			}
    		}
    		return st.nextToken();
    	}

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


import java.util.*;
import java.io.*;

public class cf1330_Div2_B{

  public static void main(String[] args){
	  FastScanner in = new FastScanner();

	  int t = in.nextInt();

	  for ( ; t > 0; --t) {
		 int n = in.nextInt();
		 int[] arr = new int[n];
		 int l1 = 0;
		 int l2 = 0;
		 for (int i = 0; i < n; i++) {
			 arr[i] = in.nextInt();
			 if (arr[i] > l2)
				 l2 = arr[i];
		 }
		 l1 = n - l2;

		 boolean flag = false;
		 int[] cnt = new int[l2 + 1];
		 for (int i = 0; i < n; i++) {
			 cnt[arr[i]]++;
			 if (cnt[arr[i]] > 2) {
				flag = true;
				break;
			 }
		 }

		 for (int i = 1; i <= l2 && !flag; i++) {
			 if (i <= l1 && cnt[i] < 2) {
				 flag = true;
				 break;
			 }
			 else if (i > l1 && cnt[i] > 1) {
				 flag = true;
				 break;
			 }
		 }

		 if (flag) {
			 System.out.println(0);
			 continue;
		 }

		 TreeSet<Integer> map = new TreeSet<Integer>();
		 int solns = 0;
		 int c = l2;
		 flag = false;
		 for (int i = 0; i < n; i++) {
			 // System.out.println(arr[i]);
			 if (!map.contains(arr[i])) {
				 c--;
				 map.add(arr[i]);
			 }
			 else {
				 break;
			 }
			 if (c == 0) {
				 flag = true;
				 break;
			 }
		 }
		 StringBuilder str = new StringBuilder();
		 if (flag) {
			 solns++;
			 str.append((l2) + " " + (l1) + "\n");
		 }

		 map = new TreeSet<Integer>();
		 flag = false;
		 c = l2;
		 for (int i = n - 1; i >= 0 && l1 != l2; i--) {
			 if (!map.contains(arr[i])) {
				 c--;
				 map.add(arr[i]);
			 }
			 else {
				 break;
			 }
			 if (c == 0) {
				 flag = true;
				 break;
			 }
		 }
		 if (flag) {
			 solns++;
			 str.append((l1) + " " + l2 + "\n");
		 }

		 if (solns > 0) {
			 System.out.println(solns);
			 System.out.print(str);
		 }
		 else
			 System.out.println(0);
	  }
  }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

        String next() {
    		while (st == null || !st.hasMoreElements()) {
    			try {
    				st = new StringTokenizer(br.readLine());
    			} catch (IOException e) {
    				e.printStackTrace();
    			}
    		}
    		return st.nextToken();
    	}

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {

	static class Task {

		int NN = 200005;
		int MOD = 1000000007;
		int INF = 2000000000;
		long INFINITY = 2000000000000000000L;

    void p(boolean [] a){
      for(int i=0;i<a.length;++i){
        System.out.print(a[i] + " ");
      }
      System.out.println();
    }

		public void solve(InputReader in, PrintWriter out) {
      int t = in.nextInt();
      while(t-->0) {
        int n = in.nextInt();
        int [] a = new int[n];
        boolean [] left = new boolean[n];
        boolean [] vl = new boolean[n + 1];
        boolean [] right = new boolean[n];
        boolean [] vr = new boolean[n + 1];
        for(int i=0;i<n;++i){
          a[i] = in.nextInt();
          left[i] = vl[i] = right[i] = vr[i] = false;
        }
        int cur = 1;
        for(int i=0;i<n;++i) {
          vl[a[i]] = true;
          while(vl[cur]) ++cur;
          if(cur-1 == i + 1) left[i] = true;
        }
        cur = 1;
        for(int i=n - 1;i>=0;--i) {
          vr[a[i]] = true;
          while(vr[cur]) ++cur;
          if(cur-1 == n-i) right[i] = true;
        }
        //p(left);p(right);
        List<Integer> ans = new ArrayList<>();
        for(int i=0;i+1<n;++i) {
          if(left[i] && right[i + 1]){
            ans.add(i + 1);ans.add(n - i - 1);
          }
        }
        out.println(ans.size()/2);
        for(int i=0;i<ans.size();i+=2) {
          out.println(ans.get(i) + " " + ans.get(i + 1));
        }
      }
    }

	}

	static void prepareIO(boolean isFileIO) {
		//long t1 = System.currentTimeMillis();
		Task solver = new Task();
		// Standard IO
		if(!isFileIO) {
			InputStream inputStream = System.in;
      OutputStream outputStream = System.out;
      InputReader in = new InputReader(inputStream);
      PrintWriter out = new PrintWriter(outputStream);
      solver.solve(in, out);
      //out.println("time(s): " + (1.0*(System.currentTimeMillis()-t1))/1000.0);
      out.close();
		}
    // File IO
		else {
			String IPfilePath = System.getProperty("user.home") + "/Downloads/ip.in";
      String OPfilePath = System.getProperty("user.home") + "/Downloads/op.out";
      InputReader fin = new InputReader(IPfilePath);
      PrintWriter fout = null;
      try {
				fout = new PrintWriter(new File(OPfilePath));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
      solver.solve(fin, fout);
      //fout.println("time(s): " + (1.0*(System.currentTimeMillis()-t1))/1000.0);
      fout.close();
		}
	}

	public static void main(String[] args) {
        prepareIO(false);
	}

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

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public InputReader(String filePath) {
        	File file = new File(filePath);
            try {
				reader = new BufferedReader(new FileReader(file));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
            tokenizer = null;
        }

        public String nextLine() {
        	String str = "";
        	try {
				str = reader.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        	return str;
        }

        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 int nextInt() {
            return Integer.parseInt(next());
        }

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

        public double nextDouble() {
        	return Double.parseDouble(next());
        }

    }

}


a,b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
e=0
for i in range(0,len(c)):
    if ((5 - c[i]) >= b):
        e=e+1
print(e//3)


a,b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
e=0
for i in range(0,len(c)):
    if ((5 - c[i]) >= k):
        e=e+1
print(e//3)


n, k = map(int, input.split())
list_1 = sorted(list(map(int, input().split())))
newList = list(map(lambda x: x + k, list_1))
sum_1 = 0
for num in newList:
    if num <= 5:
        sum_1 += 1

print(sum_1 // 3)


n, k = int(input()), int(input())
list_1 = sorted(list(map(int, input().split())))
newList = list(map(lambda x: x + k, list_1))
sum_1 = 0
for num in newList:
    if num <= 5:
        sum_1 += 1

print(sum_1 // 3)


n = int(input())
k = int(input())
list_1 = sorted(list(map(int, input().split())))
newList = list(map(lambda x: x + k, list_1))
sum_1 = 0
for num in newList:
    if num <= 5:
        sum_1 += 1

print(sum_1 // 3)


n, k = map(int, input().split())
list_1 = sorted(list(map(int, input().split())))
newList = list(map(lambda x: x + k, list_1))
sum_1 = 0
for num in newList:
    if num <= 5:
        sum_1 += 1

print(sum_1 // 3)


n,m=map(int,input().split())
a=list(map(int,input().split()))
k=0
for i in range(n):
    if a[i]+m<=5:
        k=k+1
print(k//3)


n,m=map(int,input().split())
a=list(map(int,input().split()))
k=0
for i in range(n):
    if a[i]<2:
        k=k+1
print(k//3)


a,k=[int(x) for x in input().split()]
x=[int(x)  for x in input().split()]
ans=0
for item in x:
    if 5-item>=k:
        ans+=1
print(int(ans//3))


f=lambda: map(int, input().split(' '))
n,k = f()
a = list(f())

for i in range(n):
	a[i] = 5-a[i]
c = 0
for i in a:
	if i>=k:
		c+=1

print(c//3)


from sys import stdin,stdout
N,k = map(int,stdin.readline().split())
arr = list(map(int,stdin.readline().split()))

count = 0

for i in range(len(arr)):
    if arr[i]+k <= 5:
        count += 1

print(count//3)


from sys import stdin,stdout
N,k = map(int,stdin.readline().split())
arr = list(map(int,stdin.readline().split()))

count = 0

for i in range(len(arr)):
    if arr[i]+k < 5:
        count += 1

print(count//3)


n,k = map(int,input().split())
c=0
lista=list(map(int,input().split()))

for i in lista:

    if (5-i >=k):

        c+=1

print(c//3)


import sys
import math as m
def main():
    pass
def binary(n):
    return (bin(n).replace("0b", ""))
def decimal(s):
    return (int(s, 2))
def pow2(n):
    p = 0
    while n > 1:
        n //= 2
        p += 1
    return (p)
def isPrime(n):
    if (n == 1):
        return (False)
    else:
        root = int(n ** 0.5)
        root += 1
        for i in range(2, root):
            if (n % i == 0):
                return (False)
        return (True)
def sinp(): return sys.stdin.readline().strip()
def iinp(): return int(input())
def ninp(): return map(int, sys.stdin.readline().strip().split())
def linp(): return list(map(int, sys.stdin.readline().strip().split()))
def p(a): print(a)
#for _ in range(iinp()):
n,k=[int(x) for x  in input().split()]
y=list(map(int,input().split()))
cnt=0
for i in y:
    if(5-i>=k):
        cnt+=1
print(cnt//3)


import math
import os
import random
import re
import sys
from operator import itemgetter, attrgetter

if __name__ == '__main__':
    n, k = [int(x) for x in input().strip().split()]
    y = [int(x) for x in input().strip().split()]
    r = 0

    for p in y:
        if 5 - p >= k:
            r += 1
    print("{0}".format(int(r / 3)))


n,k=map(int,input().split())
a=list(map(int,input().split()))
p=0
for i in a:
    if 5-i>=k:
        p+=1
print(p//3)


n,k=map(int,input().split())
students=list(map(int,input().split()))
students.sort(reverse=True)
avail=n
for i in range(n):
    if students[i]+k<=5:
        avail=i
        break
print(int((n-avail)//3))


n,k=map(int,input().split())
students=list(map(int,input().split()))
students.sort(reverse=True)
for i in range(n):
    if students[i]+k<=5:
        avail=i
        break
print(int((n-avail)//3))


n, k = map(int, input().split())
s = list(map(int, input().split()))
print((len([x for x in s if x + k <= 5])) // 3)


from math import factorial

n, k = map(int, input().split())
s = list(map(int, input().split()))
m, c = len([x for x in s if x + k <= 5]), 3
print(factorial(m) // (factorial(m - c) * 6) if m >= 3 else 0)


n, k = [int(x) for x in input().split()]
times = [int(x) for x in input().split()]
times.sort()
counter = teams = 0

for person in times:

    if person + k <= 5:
        counter += 1
        if counter % 3 == 0:
            teams += 1
            counter = 0
    else:
        break

print(teams)


n,k=map(int,input().split())
a=sorted(map(int,input().split()))
t=0
for i in range(0,n,3):
    if i+2<n and a[i+2]+k<=5:
        t+=1
    else:break
print(t)


import sys
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))#might need to remove the -1
def invr():
    return(map(int,input().split()))

n, k = invr()
s = inlt()
cnt =  0
for i in s:
    if i+k <= 5:
        cnt += 1
print(cnt//3)


if __name__ == '__main__':
	l = input().split()
	n, k = int(l[0]), int(l[1])
	l = input().split()
	arr = [int(x) for x in l]
	holderArr = [0]*6
	for i in arr:
		holderArr[i] += 1

	count = 0
	for i in range(6 - k):
		count += holderArr[i]
	print(int(count / 3))


arr=[0]*99
arr=list(map(int, input().split()))
n=arr[0]
k=arr[1]

cnt = 0
k = 5 - k

arr1 = [0]*n
arr1=list(map(int, input().split()))

for i in range(0,n):
    if arr1[i] <= k:
        cnt+=1

print(int(cnt/3))


import math
a,b=map(int,input().split())
l1=list(map(int,input().split()))
l2=[]
n=5-b
for i in l1:
    if i<=n:
        l2.append(i)
le=len(l2)
print(floor(le/3))


import math
a,b=map(int,input().split())
l1=list(map(int,input().split()))
l2=[]
n=5-b
for i in l1:
    if i<=n:
        l2.append(i)
le=len(l2)
print(math.floor(le/3))


n, k = map(int, input().split())
print(sum(5 - int(x) >= k for x in input().split()) // 3)


m,k=map(int,input().split());print(sum(i<=5-k for i in map(int,input().split()))//3)


n,k = map(int,input().split())
l = list(map(int,input().split()))
a = 0
b = 0
for i in l:
    if 5-i >= k:
        a+=1
    if a%3==0:
        b+=1
print(b)


n,k = map(int,input().split())
l = list(map(int,input().split()))
a = 0
b = 0
for i in l:
    if 5-i >= k:
        a+=1
    if a==3:
        b+=1
        a=0
print(b)


n = int(input())
arr = list(map(int, input().split()))

arr.sort()
count = 0

for i in range(n):
	if arr[i] > 1:
		break
	if (i+1)%3 == 0:
		count += 1

print(count)


n, k = map(int, input().split())
arr = list(map(int, input().split()))

count = 0

for i in range(n):
	if 5-arr[i] >= k:
		count += 1

print(count//3)


n, k = map(int, input().split())
arr = list(map(int, input().split()))

arr.sort()
count = 0

for i in range(n):
	if arr[i] > 1:
		break
	if (i+1)%3 == 0:
		count += 1

print(count)


n, k = map(int, input().split())
arr = list(map(int, input().split()))

arr.sort()
count = 0

for i in range(n):
	if arr[i] > 1:
		break
	if (i+1)%k == 0:
		count += 1

print(count)


n,k=input().split()
n=int(n)
k=int(k)
l=list(map(int,input().split()))
l.sort()
while(len(l)%3!=0):
    l.append(6)
    n=n+1;
count=0
i=2
while (i<n):
    if(l[i]+k<=5):
        count+=1
    i=i+3
print(count)


n,k=input().split()
n=int(n)
k=int(k)
l=list(map(int,input().split()))
l.sort()
while(len(l)%3!=0):
    l.append(6)
count=0
i=0
while (i<6):
    if(max(l[i:i+3])+k<=5):
        count+=1
    i=i+3
print(count)


n,k = [int(x) for x in input().split()]
t = [int(y) for y in input().split()]
l = []
for i in range(n):
    if t[i]+k <= 5:
        l.append(t[i])

print(len(l)//3)


li=list(map(int,input().split()))
li2=list(map(int,input().split()))
li2=sorted(li2)
res=0
rot=int(li[0]/3)
while(rot):
    if(max(li2[:3])+li[1]<=5):
        res+=1
    (li2.remove(val) for val in li2[:3])
    rot-=1
print(res)


li=list(map(int,input().split()))
li2=list(map(int,input().split()))
li2=sorted(li2)
res=0
rot=int(li[0]/3)
while(rot):
    if(max(li2[:3])+li[1]<=5):
        res+=1
    for val in li2[:3]:
        li2.remove(val)
    rot-=1
print(res)


n,k=map(int,input().split())
arr=list(map(int,input().split()))
arr.sort()
value_first_ele_not_allowed=5-k+1
ans=[]
for i in range(n):
    if arr[i]<value_first_ele_not_allowed:
        ans.append(arr[i])
    else:
        break
print(int(len(ans)/3))


n, k = map(int, input().split())
x, cnt = list(map(int, input().split())), 0

for i in x:
    if 5 - i >= k:
        cnt += 1

print(int(cnt / 3))


n,k = map(int,input().split())
y = list(map(int,input().split()))
a=[]
for i in (y):
    if(i<=5-k):
        a.append(i)
print(len(a)//3)


k=list(map(int,input().split()))
s=list(map(int,input().split()))
li=[]
for i in s:
  if k[1]+i<6:
    li.append(i)
print(len(li)//3)


n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
cnt = 0

for i in arr:
    if i + k <= 5:
        cnt += 1

print(cnt // 3)


n, k = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
ansf = 0
for i in range(2, len(arr), 3):
    x = 5 - arr[i]
    if k > x:
        ans = 0
    if k <= x:
        ans = 1
    ansf = ansf + ans
print(ansf)


n, k = map(int, input().split())
a=[int(i) for i in input().split()]
need = 5 - k
ct = 0
for i in a:
 if i <= need:
  ct+=1
print(ct//3)


n, k = input().split()
a=[int(i) for i in input().split()]
need = 5 - k
ct = 0
for i in a:
 if i <= need:
  ct+=1
print(ct//3)


def team():
  listFinal = []
  i = input()
  n,k = i.split()
  n = int(n)
  k = int(k)
  y = list(map(int,input().strip().split()))[:n]
  y.sort()
  for x in y:
    if(int(x)+k<=5):
      listFinal.append(x)
    if(int(x)+k>5):
      break
  num = len(listFinal)
  print(int(num/3))

def main():
  team()

if __name__ == "__main__":
    main()


n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
x = []
for i in range(n):
    if(a[i]<=5-k):
        x.append(a[i])
print(len(x)//3)


n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
count = 0
for i in range(n):
    if(a[i]<=5-k):
        count+=1
print(count//3)


# coding=utf-8
# Created by TheMisfits
from sys import stdin
_input = stdin.readline
_int, _range = int, range
def solution():
    n, k = [_int(i) for i in _input().split()]
    arr = [_int(i) for i in _input().split()]
    arr.sort()
    ans = 0
    for i in _range(2, n, 3):
        if arr[i] + k <= 5:
            ans += 1
    print(ans)
solution()


# coding=utf-8
# Created by TheMisfits
from sys import stdin
_input = stdin.readline
_int, _range = int, range
def solution():
    n, k = [_int(i) for i in _input().split()]
    arr = [_int(i) for i in _input().split()]
    arr.sort()
    ans = 0
    for i in _range(2, n, 3):
        if arr[i] - k <= 5:
            ans += 1
    print(ans)
solution()


a,b=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
int cnt = 0;
for i in range(a):
    if (5 - l[i] >= k)
        cnt++;a
print(cnt//3)


a,b=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
int cnt = 0;
for i in range(a):
    if (5 - l[i] >= k)
        cnt++
print(cnt//3)


a,b=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
cnt = 0;
for i in range(a):
    if (5 - l[i] >= k)
        cnt+=1
print(cnt//3)


a,b=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
cnt = 0
for i in range(a):
    if (5 - l[i] >= b):
        cnt+=1
print(cnt//3)


n,k=map(int,input().split())

a=list(map(int,input().split()))

count=0

for i in range(0,n):
    if a[i]<=5-k:
        count=count+1

print (count//3)


n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
c=0
for i in range(n):
    if (a[i]+k)<=5:
        c+=1
print(c//3)


s = input().split()

n = int(s[0])
k = int(s[1])

l = input().split()

count = 0

for i in range(n):
	if int(l[i]) <= 5-k:
		count += 1

print(count//3)


s = input().split(' ')
n = int(s[0])
k = int(s[1])
a = input().split(' ')
s = 0
for i in range(n):
    a[i] = int(a[i]) + k
    if a[i] <= 5:
        s += 1
print(s // 3)


n, k = input().split()
n, k = int(n), int(k)
l = [int(x) for x in input().split()]
l.sort()
nr = 0
for i in range(0, n, 3):
    if l[i] + k <= 5 and l[i+1] + k <= 5 and l[i+2] + k <= 5:
        nr +=1
    else:
        break
print(nr)


n, k = input().split()
n, k = int(n), int(k)
l = [int(x) for x in input().split()]
l.sort()
nr = 0
for x in l:
    if x + k <= 5:
        nr += 1
    else:
        break
print(nr // 3)


n, k = map(int, input().split())
y = list(map(int, input().split()))
count = sum(x <= 5 - k for x in y)
print(count//3)


n,k=map(int,input().split())
lis=list(map(int,input().split()))
tar=5-k
c=0
for i in lis:
    if(i<=tar):
        c+=1
print(c//3)


def team(values,k):
    count=0
    for i in range(len(values)):
        if values[i]+k<=5:
            count=count+1
    return count//3
n,k=map(int,input().split())
values=list(map(int,input().split()))
print(team(values,k))


n , k = map(int , input().split())
numbers = list(map(int , input().split()))
for i in range(n):
	numbers[i] = numbers[i] + k
count = 0
for i in numbers:
	if i <= 5:
		count +=1
print(count // 3)


n , k = map(int , input().split())
numbers = [int(i) for i in input().split() if int(i) <= 5 - k]
print(len(numbers)//3)


n,y=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
cou=0
for i in range(2,n,3):
    if(l[i]+y)<=5:
        cou+=1
print(cou)


n,k=map(int,input().split())
l=list(map(int,input().split()))
cou=0
for i in l:
    if(5-i>=k):
        cou+=1
print(cou//3)


n,k=map(int,input().split())
c=0
l=list(map(int,input().split()))
for i in range(n):
    if(l[i]+k<=5):
        c+=1
print(c//3)


import sys
import os

def changeStdioToFile():
    path = os.path.dirname(os.path.abspath(__file__))
    sys.stdin = open(f'{path}/input.txt', 'r')
    sys.stdout = open(f'{path}/output.txt', 'w')

t = 1
for _ in range(t):
    n, k = [int(x) for x in input().split()]
    a = [int(x) for x in input().split()]
    res = 0
    for num in a:
        if 5 - num >= k: res += 1
    print(res // 3)


students=list(map(int,input().split(" ")))
participated=list(map(int,input().split(" ")))
participated.sort()
count=0
for i in participated:
    if(i<=(5-students[1])):
        count+=1
    else:
        break
print(count//3)


students=list(map(int,input().split(" ")))
participated=list(map(int,input().split(" ")))
participated.sort()
count=0
for i in range(0,students[0],3):
    if(participated[i]>1):
        break
    elif(sum(participated[i:i+3])<=students[1]):
        count+=1
print(count)


students=list(map(int,input().split(" ")))
participated=list(map(int,input().split(" ")))
participated.sort()
count=0
for i in participated:
    if(students[1]!=5):
        if(i<(5-students[1])):
            count+=1
        else:
            break
    else:
        if (i<5):
            count+=1
        else:
            break
print(count//3)


students=list(map(int,input().split(" ")))
participated=list(map(int,input().split(" ")))
participated.sort()
count=0
for i in range(0,students[0],3):
    if(participated[i]>1 or participated[i+1]>1 or participated[i+2]>1):
        break
    elif(sum(participated[i:i+3])<=students[1]):
        count+=1
print(count)


students=list(map(int,input().split(" ")))
participated=list(map(int,input().split(" ")))
participated.sort()
count=0
for i in participated:
    if(i<(5-students[1])):
        count+=1
    else:
        break
print(count//3)


n,k = map(int,input().strip().split())
students = list(map(int,input().strip().split()))
students.sort()
'''print(students)

while max(students) >= 5 :
    students.pop()
print(students)

while len(students)%3 != 0:
    students.pop()
print(students)

for i in students:
    if i*k > 5:
        for v in range(3):
            students.pop()
        print(students)

teams = len(students) // 3
print(students)
print(teams)'''
while max(students)+k > 5:
    students.remove(max(students))
print(len(students)//3)


n,k = map(int,input().strip().split())
students = list(map(int,input().strip().split()))
students.sort()
'''print(students)

while max(students) >= 5 :
    students.pop()
print(students)

while len(students)%3 != 0:
    students.pop()
print(students)

for i in students:
    if i*k > 5:
        for v in range(3):
            students.pop()
        print(students)

teams = len(students) // 3
print(students)
print(teams)'''
while len(students)>0:
    if max(students)+k > 5:
        students.remove(max(students))
    else:
        break
print(len(students)//3)


n,k = map(int,input().strip().split())
students = list(map(int,input().strip().split()))
students.sort()
while max(students) >= 5 :
    students.pop()
while len(students)%3 != 0:
    students.pop()
for i in students:
    if i*k > 5:
        for v in range(3):
            students.pop()
teams = len(students) // 3
print(teams)


n,k = list(map(int,input().split()))
w = list(map(int,input().split()))
count = 0
for i in w:
    if i+k <=5:
        count +=1
print(count//3)


a, b = map(int, input().split())
c = list(map(int, input().split()))
d = 0
for i in range (a):
    if c[i] <= 5 - b:
        d += 1
print(d // 3)


n,k=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a)
c=[]
for i in range(len(a)):
    if(a[i]<=5-k):
        c.append(a[i])
print(len(c)//3)


n,k=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a)
l=0
for i in range(len(a)-4):
    if(max(a[i],max(a[i+1],a[i+2]))+k<=5):
        l+=1
        i+=3
print(l)


n,k = map(int,input().split())
a = [int(i) for i in input().split()[:n]]
cnt=0
f=0
for i in range(n):
    x = 5-a[i]
    if(x>=k):
        cnt+=1
while(cnt>=3):
    if (cnt % 3 == 0):
        f += 1
        cnt-=3

print(f)


n,k = map(int,input().split())
a = [int(i) for i in input().split()[:n]]
cnt=0
f=0
for i in range(n):
    x = n-a[i]
    if(x>k):
        cnt+=1
while(cnt>=3):
    if (cnt % 3 == 0):
        f += 1
        cnt-=3

print(f)


n,k = map(int,input().split())
a = [int(i) for i in input().split()[:n]]
cnt=0
f=0
for i in range(n):
    x = 5-a[i]
    if(x>=k):
        cnt+=1
while(cnt>=3):
        f += 1
        cnt-=3

print(f)


n, k = [int(i) for i in input().split()]
y = [int(i) for i in input().split() if int(i) <= 5 - k]
print(len(y) // 3)


n, k = map(int, input().split())
l = list(map(int, input().split()))
cnt = 0
for c in l:
    if(c + k <= 5) : cnt += 1
print(cnt//3)


n, k=map(int, input().split())
L=list(map(int, input().split()))
a=0
for i in L:
    if i+k<=5:
        a=a+1
print(a//3)


n, k = input().split(" ")
n = int(n)
k = int(k)
l = [int(i) for i in input().split(" ")]
check = []
for i in sorted(l):
    if(i+k <= 5):
        check.append(i)

print(len(check)//3)


n,k = list(map(int,input().split()))
arr = list(map(int,input().split()))
count = 0
for x in range(n):
    if 5-arr[x] >=k:
        count += 1
print(count//3)


n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(0, n, 3):
    check = 1
    if i + 3 > n: break
    for j in range(3):
        if l[i + j] + k > 5:
            check = 0
            break
    if check: ans -= -1
    else: break
print(ans)


n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(0, n, 3):
    check = 1
    for j in range(3):
        if l[i + j] + k > 5:
            check = 0
            break
    if check: ans -= -1
    else: break
print(ans)


n,k=map(lambda x:int(x),input().split())
num=input()
list=[int(x) for x in num.split()]
for i in list[:]:
    if i >5-k:
        list.remove(i)
w=len(list)//3
print(w)


a,b=map(int,input().split())
l=list(map(int,input().split()))
b=5-b
c=0
for i in range(a):
    if l[i]<=b:
        c=c+1
print(c//3)


#include <iostream>
#include <bits/stdc++.h>

using namespace std;

void fill(int arr[], int n)
{
    int num = 2;
    arr[0] = 1;
    for (int i = 1; i < n; i++)
    {
        arr[i] = num + arr[i - 1];
        num++;
    }
}

int main(int argc, char const *argv[])
{
    int n, k;

    cin >> n >> k;

    int *id = new int[n];
    int *sum = new int[k];

    fill(sum, n);

    for (int i = 0; i < n; i++)
    {
        cin >> id[i];
    }

    for (int i = 0; i < n; i++)
    {
        if (k < sum[i])
        {
            cout << id[i - (sum[i] - k)];
            break;
        }
    }

    return 0;
}


#include <iostream>
#include <bits/stdc++.h>

using namespace std;

void fill(int arr[], int n)
{
    int num = 2;
    arr[0] = 1;
    for (int i = 1; i < n; i++)
    {
        arr[i] = num + arr[i - 1];
        num++;
    }
}

int main(int argc, char const *argv[])
{
    int n, k;

    cin >> n >> k;

    int *id = new int[n];
    int *sum = new int[k];

    fill(sum, n);

    for (int i = 0; i < n; i++)
    {
        cin >> id[i];
    }

    for (int i = 0; i < n; i++)
    {
        if (k <= sum[i])
        {
            cout << id[i - (sum[i] - k)];
            break;
        }
    }

    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <exception>

using namespace std;

typedef long long ll;

int main(int argc, char const *argv[])
{
    try
    {
        ll n, k;

        cin >> n >> k;

        int *id = new int[n];
        int *sum = new int[k];

        int num = 2;
        sum[0] = 1;
        for (int i = 1; i < n; i++)
        {
            sum[i] = num + sum[i - 1];
            num++;
        }

        for (int i = 0; i < n; i++)
        {
            cin >> id[i];
        }

        for (int i = 0; i < n; i++)
        {
            if (k <= sum[i])
            {
                cout << id[i - (sum[i] - k)];
                break;
            }
        }
    }
    catch (exception &e)
    {
        cout << e.what() << '\n';
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

const int MAXN = 1000 * 1000 + 10;

long long int a[MAXN];

int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	long long int n, k;
	cin >> n >> k;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	long long int j = 1;
	while(j * (j + 1) < 2 * k)
	{
		j++;
	}
	//cout << j << endl;
	long long int t = (j * (j + 1) / 2) - k;
	cout << a[j - t] << endl;

	return 0;
}


#include<bits/stdc++.h>
//#include<iostream>
using namespace std;

const int MAXN = 100  * 1000  + 10;
//bool mark[MAXN];
//string old[MAXN];
//string ne[MAXN];
//long long int b[MAXN];
long long int a[MAXN];

int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	long long int n, k;
	cin >> n >> k;
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	long long int t = 0;
	for(long long int i = 1; i < k; i++)
	{
		if(i*i+i > 2 * k)
		{
			t = i;
			break;
		}
	}
	k = (t * (t + 1) ) / 2 - k ;
	cout << a[t - k - 1] << endl;

	return 0;
}


#include<bits/stdc++.h>
//#include<iostream>
using namespace std;

const int MAXN = 100  * 1000  + 10;
//bool mark[MAXN];
//string old[MAXN];
//string ne[MAXN];
//long long int b[MAXN];
long long int a[MAXN];

int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	long long int n, k;
	cin >> n >> k;
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	long long int t;
	for(long long int i = 1; i < k; i++)
	{
		if(i*i+i >= 2 * k)
		{
			t = i;
			break;
		}
	}
	k = (t * (t + 1) ) / 2 - k ;
	cout << a[t - k - 1] << endl;

	return 0;
}


#include<bits/stdc++.h>
//#include<iostream>
using namespace std;

const int MAXN = 100  * 1000  + 10;
//bool mark[MAXN];
//string old[MAXN];
//string ne[MAXN];
//long long int b[MAXN];
long long int a[MAXN];

int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

	long long int n, k;
	cin >> n >> k;
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	long long int t;
	for(long long int i = 1; i < k; i++)
	{
		if(i*i+i > 2 * k)
		{
			t = i;
			break;
		}
	}
	k = (t * (t + 1) ) / 2 - k ;
	cout << a[t - k - 1] << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
  ll n,k;cin>>n>>k;
  ll arr[n+1];
  for(int i=1;i<=n;i++)
    cin>>arr[i];
  ll x=0,i;
  for(i=1;i<=n;i++)
  {
    x+=i;
    if(x>k)
        break;
  }
  k-=(x-i);

  cout<<arr[k];

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
  ll n,k;cin>>n>>k;
  ll arr[n+1];
  for(int i=1;i<=n;i++)
    cin>>arr[i];
  ll x=0,i;
  for(i=1;i<=n;i++)
  {
    if(x+i>k)
        break;
  }
  k-=x;
  cout<<arr[k];

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
  ll n,k;cin>>n>>k;
  ll arr[n+1];
  for(int i=1;i<=n;i++)
    cin>>arr[i];
  ll x=0,i;
  for(i=1;i<=n;i++)
  {
    if(x+i>=k)
        break;
        x+=i;
  }
  k-=x;
  cout<<arr[k];

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
  ll n,k;cin>>n>>k;
  ll arr[n+1];
  for(int i=1;i<=n;i++)
    cin>>arr[i];
  ll x=0,i;
  for(i=1;i<=n;i++)
  {
    x+=i;
    if(x>k)
        break;
  }
  if(i>n)
    i=n;
 // cout<<x<<endl;
  k-=(x-i);
 // cout<<k<<endl;
  cout<<arr[k];

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    ll int n,k,l=0,z=0,p=0;
    cin>>n>>k;
    ll int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    z=((k-1)/2);
    p=z;
    while(z>0){
        l+=z;
        z--;
    }
    if(p==0)
        cout<<a[0];
    else if(k%l==0)
        cout<<a[p];
    else
        cout<<a[(k%l)-1];

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    ll int n,k,l=0,z=0,p=0;
    cin>>n>>k;
    ll int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    z=(k/2);
    if(z>n)
        z-=1;
    p=z;
    while(z>0){
        l+=z;
        z--;
    }
    if(p==0)
        cout<<a[0];
    else if(k%l==0)
        cout<<a[p];
    else
        cout<<a[(k%l)-1];

}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    ll int n,k,l=0,z=0,p=0;
    cin>>n>>k;
    ll int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    z=(sqrt(1+(8*k))-1)/2;
    l=(z*(z+1))/2;
    if(k%l==0)
        cout<<a[z-1];
    else
        cout<<a[(k%l)-1];
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    ll int n,k,l=0,z=0,p=0;
    cin>>n>>k;
    ll int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    z=((k-1)/2);
    p=z;
    while(z>0){
        l+=z;
        z--;
    }
    if(p==0)
        cout<<a[0];
    else if(k%l==0)
        cout<<a[p-1];
    else
        cout<<a[(k%l)-1];

}


    #include<bits/stdc++.h>
    using namespace std;
    #define inp(k)           ll k;cin>>k;
    #define in2(n,k)       ll n, k; cin>>n;cin>>k;
    #define in3(n,k,r)       ll n, k,r; cin>>n;cin>>k;cin>>r;
    #define ll long long
    #define dl double
    #define ch char
    #define f(i,a,b) for(ll i=a;i<b;i++)
    #define rf(i,a,b) for(ll i=a-1;i>=b;i--)
    #define Godspeed                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define vpl vector< pair<ll,ll> >
    #define vpi vector< pair<int,int> >
    #define vi vector<int>
    #define vl vector<ll>
    #define vdl vector<dl>
    #define vch vector<char>
    #define pll pair<ll,ll>
    #define pb push_back
    #define mp make_pair
    #define fr first
    #define se second
    #define PI 3.14159265

    void solve()
    {
        in2(n,k);
        ll a[n];f(i,0,n)cin>>a[i];
        if(k==1){cout<<a[0];return;}
        ll p=1;
        while(1)
        {
            if(p*(p+1)>2*k)
                break;
            p++;
        }
        k-=(p*(p-1))/2;
        if(k==0)k=n-1;
        cout<<a[k-1];
    }

    int32_t main(void)
    {
        Godspeed;
        int q;
        q=1;
        //cin >> q;
        while (q--)
        {
            solve();cout<<endl;
        }
        return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define inp(k)           ll k;cin>>k;
    #define in2(n,k)       ll n, k; cin>>n;cin>>k;
    #define in3(n,k,r)       ll n, k,r; cin>>n;cin>>k;cin>>r;
    #define ll long long
    #define dl double
    #define ch char
    #define f(i,a,b) for(ll i=a;i<b;i++)
    #define rf(i,a,b) for(ll i=a-1;i>=b;i--)
    #define Godspeed                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define vpl vector< pair<ll,ll> >
    #define vpi vector< pair<int,int> >
    #define vi vector<int>
    #define vl vector<ll>
    #define vdl vector<dl>
    #define vch vector<char>
    #define pll pair<ll,ll>
    #define pb push_back
    #define mp make_pair
    #define fr first
    #define se second
    #define PI 3.14159265

    void solve()
    {
        in2(n,k);
        ll a[n];f(i,0,n)cin>>a[i];
        if(k==1){cout<<a[0];return;}
        ll p=1;
        while(1)
        {
            if(p*(p+1)>2*k)
                break;
            p++;
        }
        k-=(p*(p-1))/2;
        if(k==0)k=n;
        cout<<a[k-1];
    }

    int32_t main(void)
    {
        Godspeed;
        int q;
        q=1;
        //cin >> q;
        while (q--)
        {
            solve();cout<<endl;
        }
        return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define inp(k)           ll k;cin>>k;
    #define in2(n,k)       ll n, k; cin>>n;cin>>k;
    #define in3(n,k,r)       ll n, k,r; cin>>n;cin>>k;cin>>r;
    #define ll long long
    #define dl double
    #define ch char
    #define f(i,a,b) for(ll i=a;i<b;i++)
    #define rf(i,a,b) for(ll i=a-1;i>=b;i--)
    #define Godspeed                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define vpl vector< pair<ll,ll> >
    #define vpi vector< pair<int,int> >
    #define vi vector<int>
    #define vl vector<ll>
    #define vdl vector<dl>
    #define vch vector<char>
    #define pll pair<ll,ll>
    #define pb push_back
    #define mp make_pair
    #define fr first
    #define se second
    #define PI 3.14159265

    void solve()
    {
        in2(n,k);
        ll a[n];f(i,0,n)cin>>a[i];
        if(k==1){cout<<a[0];return;}
        ll p=0;
        while(1)
        {
            if(p*(p+1)>2*k)
                break;
            p++;
        }
        k-=(p*(p-1))/2;
        if(k<=0) k+=p-1;
        cout<<a[k-1];
    }

    int32_t main(void)
    {
        Godspeed;
        int q;
        q=1;
        //cin >> q;
        while (q--)
        {
            solve();cout<<endl;
        }
        return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define inp(k)           ll k;cin>>k;
    #define in2(n,k)       ll n, k; cin>>n;cin>>k;
    #define in3(n,k,r)       ll n, k,r; cin>>n;cin>>k;cin>>r;
    #define ll long long
    #define dl double
    #define ch char
    #define f(i,a,b) for(ll i=a;i<b;i++)
    #define rf(i,a,b) for(ll i=a-1;i>=b;i--)
    #define Godspeed                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define vpl vector< pair<ll,ll> >
    #define vpi vector< pair<int,int> >
    #define vi vector<int>
    #define vl vector<ll>
    #define vdl vector<dl>
    #define vch vector<char>
    #define pll pair<ll,ll>
    #define pb push_back
    #define mp make_pair
    #define fr first
    #define se second
    #define PI 3.14159265

    void solve()
    {
        in2(n,k);
        ll a[n];f(i,0,n)cin>>a[i];
        if(k==1){cout<<a[0];return;}
        ll p=1;
        while(1)
        {
            if(p*(p+1)>2*k)
                break;
            p++;
        }
        k-=(p*(p-1))/2;
        if(k<=0) k=n-k;
        cout<<a[k-1];
    }

    int32_t main(void)
    {
        Godspeed;
        int q;
        q=1;
        //cin >> q;
        while (q--)
        {
            solve();cout<<endl;
        }
        return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define inp(k)           ll k;cin>>k;
    #define in2(n,k)       ll n, k; cin>>n;cin>>k;
    #define in3(n,k,r)       ll n, k,r; cin>>n;cin>>k;cin>>r;
    #define ll long long
    #define dl double
    #define ch char
    #define f(i,a,b) for(ll i=a;i<b;i++)
    #define rf(i,a,b) for(ll i=a-1;i>=b;i--)
    #define Godspeed                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define vpl vector< pair<ll,ll> >
    #define vpi vector< pair<int,int> >
    #define vi vector<int>
    #define vl vector<ll>
    #define vdl vector<dl>
    #define vch vector<char>
    #define pll pair<ll,ll>
    #define pb push_back
    #define mp make_pair
    #define fr first
    #define se second
    #define PI 3.14159265

    void solve()
    {
        in2(n,k);
        ll a[n];f(i,0,n)cin>>a[i];
        if(k==1){cout<<a[0];return;}
        ll p=1;
        while(1)
        {
            if(p*(p+1)>2*k)
                break;
            p++;
        }
        k-=(p*(p-1))/2;
        cout<<a[k-1];
    }

    int32_t main(void)
    {
        Godspeed;
        int q;
        q=1;
        //cin >> q;
        while (q--)
        {
            solve();cout<<endl;
        }
        return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define inp(k)           ll k;cin>>k;
    #define in2(n,k)       ll n, k; cin>>n;cin>>k;
    #define in3(n,k,r)       ll n, k,r; cin>>n;cin>>k;cin>>r;
    #define ll long long
    #define dl double
    #define ch char
    #define f(i,a,b) for(ll i=a;i<b;i++)
    #define rf(i,a,b) for(ll i=a-1;i>=b;i--)
    #define Godspeed                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define vpl vector< pair<ll,ll> >
    #define vpi vector< pair<int,int> >
    #define vi vector<int>
    #define vl vector<ll>
    #define vdl vector<dl>
    #define vch vector<char>
    #define pll pair<ll,ll>
    #define pb push_back
    #define mp make_pair
    #define fr first
    #define se second
    #define PI 3.14159265

    void solve()
    {
        in2(n,k);
        ll a[n];f(i,0,n)cin>>a[i];
        if(n==1){cout<<a[0];return;}
        ll p=1;
        while(1)
        {
            if(p*(p+1)>2*k)
                break;
            p++;
        }
        k-=(p*(p-1))/2;
        cout<<a[k-1];
    }

    int32_t main(void)
    {
        Godspeed;
        int q;
        q=1;
        //cin >> q;
        while (q--)
        {
            solve();cout<<endl;
        }
        return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define inp(k)           ll k;cin>>k;
    #define in2(n,k)       ll n, k; cin>>n;cin>>k;
    #define in3(n,k,r)       ll n, k,r; cin>>n;cin>>k;cin>>r;
    #define ll long long
    #define dl double
    #define ch char
    #define f(i,a,b) for(ll i=a;i<b;i++)
    #define rf(i,a,b) for(ll i=a-1;i>=b;i--)
    #define Godspeed                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define vpl vector< pair<ll,ll> >
    #define vpi vector< pair<int,int> >
    #define vi vector<int>
    #define vl vector<ll>
    #define vdl vector<dl>
    #define vch vector<char>
    #define pll pair<ll,ll>
    #define pb push_back
    #define mp make_pair
    #define fr first
    #define se second
    #define PI 3.14159265

    void solve()
    {
        in2(n,k);
        ll a[n];f(i,0,n)cin>>a[i];
        if(k==1){cout<<a[0];return;}
        ll p=0;
        while(1)
        {
            if(p*(p+1)>2*k)
                break;
            p++;
        }
        k-=(p*(p-1))/2;
        if(k<=0) k+=p-1;
        cout<<a[k-1];
    }

    int32_t main(void)
    {
        Godspeed;
        int q;
        q=1;
        cin >> q;
        while (q--)
        {
            solve();cout<<endl;
        }
        return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define inp(k)           ll k;cin>>k;
    #define in2(n,k)       ll n, k; cin>>n;cin>>k;
    #define in3(n,k,r)       ll n, k,r; cin>>n;cin>>k;cin>>r;
    #define ll long long
    #define dl double
    #define ch char
    #define f(i,a,b) for(ll i=a;i<b;i++)
    #define rf(i,a,b) for(ll i=a-1;i>=b;i--)
    #define Godspeed                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define vpl vector< pair<ll,ll> >
    #define vpi vector< pair<int,int> >
    #define vi vector<int>
    #define vl vector<ll>
    #define vdl vector<dl>
    #define vch vector<char>
    #define pll pair<ll,ll>
    #define pb push_back
    #define mp make_pair
    #define fr first
    #define se second
    #define PI 3.14159265

    void solve()
    {
        in2(n,k);
        ll a[n];f(i,0,n)cin>>a[i];
        if(k==1){cout<<a[0];return;}
        ll p=1;
        while(1)
        {
            if(p*(p+1)>2*k)
                break;
            p++;
        }
        k-=(p*(p-1))/2;
        if(k<=0) k=n+k;
        cout<<a[k-1];
    }

    int32_t main(void)
    {
        Godspeed;
        int q;
        q=1;
        //cin >> q;
        while (q--)
        {
            solve();cout<<endl;
        }
        return 0;
    }


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned ll
#define vi vector <int>
#define ii pair <int, int>
#define vii vector <ii>
#define vll vector <ll>
#define vull vector <ull>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define INF (int)1e9
#define EPS 1e-9
#define pb emplace_back
#define PI acos(-1.0)
#define endl "\n"
#define mp make_pair
#define DEBUG 0

int main ()

{
    fast;

    int n, k;
    cin >> n >> k;

    vi num(n+1, 0);

    for (int y=1; y<=n; y++)
    {
        cin >> num[y];
    }

    int answer = ( -0.5 + 0.5*sqrt(1.0 + 8.0*k) );
    k -= (answer*(answer+1))/2;

    cout << num[k] << endl;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned ll
#define vi vector <int>
#define ii pair <int, int>
#define vii vector <ii>
#define vll vector <ll>
#define vull vector <ull>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define INF (int)1e9
#define EPS 1e-9
#define pb emplace_back
#define PI acos(-1.0)
#define endl "\n"
#define mp make_pair
#define DEBUG 0

int main ()

{
    fast;

    int n, k;
    cin >> n >> k;

    vi num(n+1, 0);

    for (int y=1; y<=n; y++)
    {
        cin >> num[y];
    }

    int answer = ( -0.5 + 0.5*sqrt(1.0 + 8.0*k) );
    k -= answer;

    cout << num[k-1] << endl;

}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned ll
#define vi vector <int>
#define ii pair <int, int>
#define vii vector <ii>
#define vll vector <ll>
#define vull vector <ull>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define INF (int)1e9
#define EPS 1e-9
#define pb emplace_back
#define PI acos(-1.0)
#define endl "\n"
#define mp make_pair
#define DEBUG 0

int main ()

{
    fast;

    int n, k;
    cin >> n >> k;

    vi num(n+1, 0);

    for (int y=1; y<=n; y++)
    {
        cin >> num[y];
    }

    int answer = ( -0.5 + 0.5*sqrt(1.0 + 8.0*k) );
    if (answer*(answer+1) == k*2)
    k -= (answer*(answer-1))/2;
    else
    k -= (answer*(answer+1))/2;

  cout << num[k] << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned ll
#define vi vector <int>
#define ii pair <int, int>
#define vii vector <ii>
#define vll vector <ll>
#define vull vector <ull>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define INF (int)1e9
#define EPS 1e-9
#define pb emplace_back
#define PI acos(-1.0)
#define endl "\n"
#define mp make_pair
#define DEBUG 0

int main ()

{
    fast;

    int n, k;
    cin >> n >> k;

    vi num(n+1, 0);

    for (int y=1; y<=n; y++)
    {
        cin >> num[y];
    }

    int answer = ( -0.5 + 0.5*sqrt(1.0 + 8.0*k) );
    k -= (answer*(answer+1))/2;

    if (k == 0) cout << num[1] << endl;
    else cout << num[k] << endl;

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
 const ll N=1e7;
 ll n,k,a[N],X=1,Y;
 int main()
 {
    cin>>n>>k;
    for(ll i=1;i<=n;++i)cin>>a[i];
    while(k-X>0){
    	k-=X;
    	X++;
	}
	cout<<a[k];
 }


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
 const ll N=1e6;
 ll n,k,a[N],X;
 int main()
 {
    cin>>n>>k;
    for(ll i=1;i<=n;++i)cin>>a[i];
    X=sqrt(k);
    if((X+1)*(X+2)/2<k)++X;
    cout<<a[max(k-X*(X+1)/2,1LL)];
 }


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
 const ll N=1e6;
 ll n,k,a[N],X;
 int main()
 {
    cin>>n>>k;
    for(ll i=1;i<=n;++i)cin>>a[i];
    X=sqrt(k);
    if((X+1)*(X+2)/2<k)++X;
    cout<<a[k-X*(X+1)/2];
 }


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
 const ll N=1e7;
 ll n,k,a[N],X,Y;
 int main()
 {
    cin>>n>>k;
    for(ll i=1;i<=n;++i)cin>>a[i];
    X=sqrt(k);
    if(k-X*(X+1)/2==0)cout<<a[X];
    else cout<<a[k-X*(X+1)/2];
 }


//Md. Shajibul Islam..
//East West University, CSE Department'19

#include<bits/stdc++.h>
using namespace std;
#define FAST             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define loop(i,n)        for(int i=0;i<n;i++)
#define CASE_PRINT       cout<<"Case "<<C<<": "
#define CASE_PRINT2      cout<<"Case "<<C<<":"<<endl
#define ll               long long
#define ld               long double
#define Pi               2*acos(0.0) // acos(-1.0)

int main()
{
    FAST;
    int n,k;cin>>n>>k;

    vector<int>v(n);
    for(int i=0;i<n;i++)cin>>v[i];

    //ll total = (n*(n+1))/2;
    int cnt=0;

    for(ll i=1;i<=2000000000;i++)
    {
        if(k-i>0)k-=i;
        else {cout<<v[k-1]<<endl; return 0;}
    }
}


//Md. Shajibul Islam..
//East West University, CSE Department'19

#include<bits/stdc++.h>
using namespace std;
#define FAST             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define loop(i,n)        for(int i=0;i<n;i++)
#define CASE_PRINT       cout<<"Case "<<C<<": "
#define CASE_PRINT2      cout<<"Case "<<C<<":"<<endl
#define ll               long long
#define ld               long double
#define Pi               2*acos(0.0) // acos(-1.0)

int main()
{
    FAST;
    int n,k;cin>>n>>k;

    vector<int>v(n);
    for(int i=0;i<n;i++)cin>>v[i];

    ll total = (n*(n+1))/2;
    int cnt=0;

    for(ll i=1;i<=total;i++)
    {
        if(k-i>0)k-=i;
        else {cout<<v[k-1]<<endl; return 0;}
    }
}


//Md. Shajibul Islam..
//East West University, CSE Department'19

#include<bits/stdc++.h>
using namespace std;
#define FAST             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define loop(i,n)        for(int i=0;i<n;i++)
#define CASE_PRINT       cout<<"Case "<<C<<": "
#define CASE_PRINT2      cout<<"Case "<<C<<":"<<endl
#define ll               long long
#define ld               long double
#define Pi               2*acos(0.0) // acos(-1.0)

int main()
{
    FAST;
    int n,k;cin>>n>>k;

    vector<int>v(n);
    for(int i=0;i<n;i++)cin>>v[i];

    ll total = (n*(n+1))/2;
    int cnt=0;
    for(ll i=1;i<=n+1;i++)
    {
        for(int j=0;j<i;j++)
        {
            cnt++;
            if(cnt==k)
            {
                cout<<v[j]<<endl;
                return 0;
            }
        }
    }
}


//Md. Shajibul Islam..
//East West University, CSE Department'19

#include<bits/stdc++.h>
using namespace std;
#define FAST             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define loop(i,n)        for(int i=0;i<n;i++)
#define CASE_PRINT       cout<<"Case "<<C<<": "
#define CASE_PRINT2      cout<<"Case "<<C<<":"<<endl
#define ll               long long
#define ld               long double
#define Pi               2*acos(0.0) // acos(-1.0)

int main()
{
    FAST;
    int n,k;cin>>n>>k;

    vector<int>v(n);
    for(int i=0;i<n;i++)cin>>v[i];

    ll total = (n*(n+1))/2;
    int cnt=0;
    for(ll i=1;i<=total;i++)
    {
        for(int j=0;j<i;j++)
        {
            cnt++;
            if(cnt==k)
            {
                cout<<v[j]<<endl;
                return 0;
            }
        }
    }
}


#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#define lli long long int
#define loop(i,x,n) for(int i=x;i<n;i++)
#define loopr(i,x,n) for(int i=n-1;i>=x;i--)
#define st set<lli>
#define v vector<lli>
#define um unordered_map<lli,lli>
#define vpl vector<pair<lli,lli>>
#define llu long long unsigned
#define ms muliset<int,greater<int>>
#define ums unordered_map<string,lli>
#define pb push_back
#define mss map<string,set<string,greater<string>>>
#define loopall(i,x) for(auto i=x.begin();i!=x.end();i++)
#define loopallr(i,x) for(auto i=(x.end()-1);i!=(x.begin()-1);i--)
#define time ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define test lli t; cin>>t; while(t--)
using namespace std;
int gcd(int a,int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}
int main()
{
    time
    lli n,k;
    cin>>n>>k;
    lli j=0;
    loop(i,1,n+1)
    {
        if(((i*(i+1))/2)>k){ j=i; break;}
    }
    k-=((j-1)*(j))/2;
    lli a[n];
    loop(i,0,n) cin>>a[i];
    if(k==0) cout<<a[j-1];
    else cout<<a[k-1];
    cout<<endl;
    return 0;
}


#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#define lli long long int
#define loop(i,x,n) for(int i=x;i<n;i++)
#define loopr(i,x,n) for(int i=n-1;i>=x;i--)
#define st set<lli>
#define v vector<lli>
#define um unordered_map<lli,lli>
#define vpl vector<pair<lli,lli>>
#define llu long long unsigned
#define ms muliset<int,greater<int>>
#define ums unordered_map<string,lli>
#define pb push_back
#define mss map<string,set<string,greater<string>>>
#define loopall(i,x) for(auto i=x.begin();i!=x.end();i++)
#define loopallr(i,x) for(auto i=(x.end()-1);i!=(x.begin()-1);i--)
#define time ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define test lli t; cin>>t; while(t--)
using namespace std;
int gcd(int a,int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}
int main()
{
    time
    lli n,k;
    cin>>n>>k;
    lli j=0;
    loop(i,1,n+2)
    {
        if(((i*(i+1))/2)>k){ j=i; break;}
    }
    k=k-(((j-1)*(j))/2);
    lli a[n];
    loop(i,0,n) cin>>a[i];
    if(k==0) cout<<a[j-2];
    else cout<<a[k-1];
    cout<<endl;
    return 0;
}


#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#define lli long long int
#define llu long long unsigned
#define loop(i,x,n) for(llu i=x;i<n;i++)
#define loopr(i,x,n) for(llu i=n-1;i>=x;i--)
#define st set<lli>
#define v vector<lli>
#define um unordered_map<lli,lli>
#define vpl vector<pair<lli,lli>>
#define ms muliset<int,greater<int>>
#define ums unordered_map<string,lli>
#define pb push_back
#define mss map<string,set<string,greater<string>>>
#define loopall(i,x) for(auto i=x.begin();i!=x.end();i++)
#define loopallr(i,x) for(auto i=(x.end()-1);i!=(x.begin()-1);i--)
#define time ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define test lli t; cin>>t; while(t--)
using namespace std;
int gcd(int a,int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}
int main()
{
    time
    lli n,k;
    cin>>n>>k;
    lli j=0;
    loop(i,1,n+2)
    {
        if(((i*(i+1))/2)>k){ j=i; break;}
    }
    k=k-(((j-1)*(j))/2);
    lli a[n];
    loop(i,0,n) cin>>a[i];
    if(k==0) cout<<a[j-2];
    else cout<<a[k-1];
    cout<<endl;
    return 0;
}


#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#define lli long long int
#define loop(i,x,n) for(int i=x;i<n;i++)
#define loopr(i,x,n) for(int i=n-1;i>=x;i--)
#define st set<lli>
#define v vector<lli>
#define um unordered_map<lli,lli>
#define vpl vector<pair<lli,lli>>
#define llu long long unsigned
#define ms muliset<int,greater<int>>
#define ums unordered_map<string,lli>
#define pb push_back
#define mss map<string,set<string,greater<string>>>
#define loopall(i,x) for(auto i=x.begin();i!=x.end();i++)
#define loopallr(i,x) for(auto i=(x.end()-1);i!=(x.begin()-1);i--)
#define time ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define test lli t; cin>>t; while(t--)
using namespace std;
int gcd(int a,int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}
int main()
{
    time
    lli n,k;
    cin>>n>>k;
    lli j=0;
    loop(i,1,n+1)
    {
        if(((i*(i+1))/2)>k){ j=i; break;}
    }
    k-=((j-1)*(j))/2;
    lli a[n];
    loop(i,0,n) cin>>a[i];
    if(k==0) cout<<a[j-2];
    else cout<<a[k-1];
    cout<<endl;
    return 0;
}


#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#define lli long long int
#define loop(i,x,n) for(int i=x;i<n;i++)
#define loopr(i,x,n) for(int i=n-1;i>=x;i--)
#define st set<lli>
#define v vector<lli>
#define um unordered_map<lli,lli>
#define vpl vector<pair<lli,lli>>
#define llu long long unsigned
#define ms muliset<int,greater<int>>
#define ums unordered_map<string,lli>
#define pb push_back
#define mss map<string,set<string,greater<string>>>
#define loopall(i,x) for(auto i=x.begin();i!=x.end();i++)
#define loopallr(i,x) for(auto i=(x.end()-1);i!=(x.begin()-1);i--)
#define time ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define test lli t; cin>>t; while(t--)
using namespace std;
int gcd(int a,int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}
int main()
{
    time
    llu n,k;
    cin>>n>>k;
    llu j=0;
    loop(i,1,n+2)
    {
        if(((i*(i+1))/2)>k){ j=i; break;}
    }
    k=k-(((j-1)*(j))/2);
    llu a[n];
    loop(i,0,n) cin>>a[i];
    if(k==0) cout<<a[j-2];
    else cout<<a[k-1];
    cout<<endl;
    return 0;
}


#include <iostream>
#include <cmath>

using namespace std;

int main(){
    long long int n,k;
    cin>>n>>k;
    long long int arr[n];
    for(long long int i=0;i<n;i++)cin>>arr[i];
    long long int n_;
    n_=floor((-1+sqrt(1+ 8*k))/2);

    if(k==n_*(n_+1)/2){cout<<arr[k-1]<<endl;}
    else {cout<<arr[(k-(n_*(n_+1)/2))-1]<<endl;}
}


#include <iostream>
#include <cmath>

using namespace std;

int main(){
    long long int n,k;
    cin>>n>>k;
    long long int arr[n];
    for(long long int i=0;i<n;i++)cin>>arr[i];
    long long int n_;
    n_=ceil((-1+sqrt(1+ 8*k))/2);

    if(n_==k){cout<<arr[k-1]<<endl;cout<<"x";}
    else {cout<<arr[(k-n_)-1]<<endl;cout<<"y";}
}


#include <iostream>
#include <cmath>

using namespace std;

int main(){
    long long int n,k;
    cin>>n>>k;
    long long int arr[n];
    for(long long int i=0;i<n;i++)cin>>arr[i];
    long long int n_;
    n_=ceil((-1+sqrt(1+ 8*k))/2);

    if(n_==k)cout<<arr[k]<<endl;
    else cout<<arr[(k-n_)-1]<<endl;
}


#include <iostream>
#include <cmath>

using namespace std;

int main(){
    long long int n,k;
    cin>>n>>k;
    long long int arr[n];
    for(long long int i=0;i<n;i++)cin>>arr[i];
    long long int n_;
    n_=floor((-1+sqrt(1+ 8*k))/2);

    if(k==n_*(n_+1)/2){cout<<arr[n_-1]<<endl;}
    else {cout<<arr[(k-(n_*(n_+1)/2))-1]<<endl;}
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
int n , k , a;
cin >> n >> k; string  res,s, w;
for (int i=0;i<n;i++)
{
cin >> w;
s+=w;
res+=s;
}
cout << res[k-1];

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
int n , k , a  , sum=0, arr[100000];
cin >> n >> k;
for (int i=0;i<n;i++)
{
cin >> arr[i];
}
for (int i=0;sum+i+1 < n;i++)
    {
sum+=i;
    }
cout << arr[k-sum-1];

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
int n , k , a  , sum=0, arr[100000];
cin >> n >> k;
for (int i=0;i<n;i++)
{
cin >> arr[i];
}
for (int i=0;sum+i < n;i++)
    {
sum+=i;
    }
cout << arr[k-sum-1];

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
int n , k , a  , sum=0, arr[100000];
cin >> n >> k;
for (int i=0;i<n;i++)
{
cin >> arr[i];
}
for (int i=0;sum+i+1 <= n;i++)
    {
sum+=i;
    }
cout << arr[k-sum-1];

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
int n , k , a  , sum=0, arr[100000];
cin >> n >> k;
for (int i=0;i<n;i++)
{
cin >> arr[i];
}
for (int i=0;sum+i+1 <= k;i++)
    {
sum+=i;
    }
cout << arr[k-sum-1];

    return 0;
}


    #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int main()
    {
        IOS;
        long long a,b,c,d,e,g,h,n,t,f,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,arr1[100],arr[200001],sum=0,sum1=0,ma=0,mi=10000000001;
        long long co3=0,co4=0,co5=0,co6=0,co7=0,co8=0;
        double pi=2 * acos (0.0);
        string str,str1,str2,str3;
        char ch;

        vector<long long>v;
        vector<long long>v1;
        vector<string>vs;
        vector<string>vs1;
        map<string,string>mp;
        set<long long>s;
        set<long long>s1;
        set<long long>::iterator it;
        set<long long>::iterator it1;
        //map<string,string>::iterator it;
       // vector< pair<int,int > > v;
        int x[]={1,-1,1,-1,2,2,-2,-2};
        int y[]={2,2,-2,-2,1,-1,1,-1};
        cin>>a>>b;
        for(int i=0; i<a; i++)
        {
            cin>>c;
            v.push_back(c);
        }
        for(int i=1; ;i++)
        {
            sum=sum+i;
            if(sum==b)
            {
                d=i;
                break;
            }
            if(sum>b)
            {
                d=i-1;
                sum-=i;
                break;
            }
        }
        if(sum==b)
            cout<<v[d-1]<<endl;
        else
        {
            e=b-sum;
            cout<<v[e-1]<<endl;
        }
        return 0;
    }


#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    IOS;
    long long a,b,c,d,e,g,h,n,t,f,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,arr1[100],arr[200001],sum=0,sum1=0,ma=0,mi=10000000001;
    long long co3=0,co4=0,co5=0,co6=0,co7=0,co8=0;
    double pi=2 * acos (0.0);
    string s,str,str1,str2,str3;
    char ch;
    //set<long long>::iterator it;
    vector<long long>v;
    vector<long long>v1;
    vector<string>vs;
    vector<string>vs1;
    map<string,string>mp;
    //map<string,string>::iterator it;
   // vector< pair<int,int > > v;
    int x[]={1,-1,1,-1,2,2,-2,-2};
    int y[]={2,2,-2,-2,1,-1,1,-1};
    cin>>a>>b;
    for(long long i=0; i<a; i++)
    {
        cin>>c;
        v.push_back(c);
    }
    for(long long i=1; i<=a; i++)
    {
        for(long long j=1; j<=i; j++)
        {
            co++;
            if(co==b)
            {
                cout<<v[j-1]<<endl;
                return 0;
            }
        }
    }
    return 0;
}


    #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int main()
    {
        IOS;
        long long a,b,c,d,e,g,h,n,t,f,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,arr1[100],arr[200001],sum=0,sum1=0,ma=0,mi=10000000001;
        long long co3=0,co4=0,co5=0,co6=0,co7=0,co8=0;
        double pi=2 * acos (0.0);
        string str,str1,str2,str3;
        char ch;

        vector<long long>v;
        vector<long long>v1;
        vector<string>vs;
        vector<string>vs1;
        map<string,string>mp;
        set<long long>s;
        set<long long>s1;
        set<long long>::iterator it;
        set<long long>::iterator it1;
        //map<string,string>::iterator it;
       // vector< pair<int,int > > v;
        int x[]={1,-1,1,-1,2,2,-2,-2};
        int y[]={2,2,-2,-2,1,-1,1,-1};
        cin>>a>>b;
        for(int i=0; i<a; i++)
        {
            cin>>c;
            v.push_back(c);
        }
        for(int i=1; ;i++)
        {
            sum=sum+((i*(i+1))/2);
            //cout<<sum<<endl;
            if(sum>=b)
            {
                d=i-1;
                break;
            }
        }
        //cout<<d<<endl;
        e=(d*(d+1))/2;
       // cout<<e<<endl;
        f=b-e;
        cout<<v[f-1]<<endl;
        return 0;
    }


#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    IOS;
    long long a,b,c,d,e,g,h,n,t,f,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,arr1[100],arr[200001],sum=0,sum1=0,ma=0,mi=10000000001;
    long long co3=0,co4=0,co5=0,co6=0,co7=0,co8=0;
    double pi=2 * acos (0.0);
    string s,str,str1,str2,str3;
    char ch;
    //set<long long>::iterator it;
    vector<long long>v;
    vector<long long>v1;
    vector<string>vs;
    vector<string>vs1;
    map<string,string>mp;
    //map<string,string>::iterator it;
   // vector< pair<int,int > > v;
    int x[]={1,-1,1,-1,2,2,-2,-2};
    int y[]={2,2,-2,-2,1,-1,1,-1};
    cin>>a>>b;
    for(int i=0; i<a; i++)
    {
        cin>>c;
        v.push_back(c);
    }
    for(int i=1; i<=a; i++)
    {
        for(int j=1; j<=i; j++)
        {
            v1.push_back(j);
        }
    }
    cout<<v[v1[b-1]-1]<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    IOS;
    long long a,b,c,d,e,g,h,n,t,f,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,arr1[100],arr[200001],sum=0,sum1=0,ma=0,mi=10000000001;
    long long co3=0,co4=0,co5=0,co6=0,co7=0,co8=0;
    double pi=2 * acos (0.0);
    string s,str,str1,str2,str3;
    char ch;
    //set<long long>::iterator it;
    vector<long long>v;
    vector<long long>v1;
    vector<string>vs;
    vector<string>vs1;
    map<string,string>mp;
    //map<string,string>::iterator it;
   // vector< pair<int,int > > v;
    int x[]={1,-1,1,-1,2,2,-2,-2};
    int y[]={2,2,-2,-2,1,-1,1,-1};
    cin>>a>>b;
    for(long long i=0; i<a; i++)
    {
        cin>>c;
        v.push_back(c);
    }
    for(long long i=1; i<=a; i++)
    {
        for(long long j=1; j<=i; j++)
        {
            v1.push_back(j);
        }
    }
    cout<<v[v1[b-1]-1]<<endl;
    return 0;
}


    #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int main()
    {
        IOS;
        long long a,b,c,d,e,g,h,n,t,f,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,arr1[100],arr[200001],sum=0,sum1=0,ma=0,mi=10000000001;
        long long co3=0,co4=0,co5=0,co6=0,co7=0,co8=0;
        double pi=2 * acos (0.0);
        string str,str1,str2,str3;
        char ch;

        vector<long long>v;
        vector<long long>v1;
        vector<string>vs;
        vector<string>vs1;
        map<string,string>mp;
        set<long long>s;
        set<long long>s1;
        set<long long>::iterator it;
        set<long long>::iterator it1;
        //map<string,string>::iterator it;
       // vector< pair<int,int > > v;
        int x[]={1,-1,1,-1,2,2,-2,-2};
        int y[]={2,2,-2,-2,1,-1,1,-1};
        cin>>a>>b;
        for(int i=0; i<a; i++)
        {
            cin>>c;
            v.push_back(c);
        }
        for(int i=1; ;i++)
        {
            sum=sum+((i*(i+1))/2);
            //cout<<sum<<endl;
            if(sum==b)
            {
                d=i;
                break;
            }
            if(sum>b)
            {
                d=i-1;
                break;
            }
        }
        if(sum==b)
        {
            cout<<v[d-1]<<endl;
            return 0;
        }
        e=(d*(d+1))/2;
        f=b-e;
        cout<<v[f-1]<<endl;
        return 0;
    }


    #include<bits/stdc++.h>
    using namespace std;
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int main()
    {
        IOS;
        long long a,b,c,d,e,g,h,n,t,f,f1=0,flag=0,flag1=0,co=0,co1=0,co2=0,arr1[100],arr[200001],sum=0,sum1=0,ma=0,mi=10000000001;
        long long co3=0,co4=0,co5=0,co6=0,co7=0,co8=0;
        double pi=2 * acos (0.0);
        string str,str1,str2,str3;
        char ch;

        vector<long long>v;
        vector<long long>v1;
        vector<string>vs;
        vector<string>vs1;
        map<string,string>mp;
        set<long long>s;
        set<long long>s1;
        set<long long>::iterator it;
        set<long long>::iterator it1;
        //map<string,string>::iterator it;
       // vector< pair<int,int > > v;
        int x[]={1,-1,1,-1,2,2,-2,-2};
        int y[]={2,2,-2,-2,1,-1,1,-1};
        cin>>a>>b;
        for(int i=0; i<a; i++)
        {
            cin>>c;
            v.push_back(c);
        }
        for(int i=1; ;i++)
        {
            sum=((i*(i+1))/2);
            if(sum>b)
            {
                d=i-1;
                break;
            }
        }
        cout<<v[d-1]<<endl;
        return 0;
    }