package net.ipipip0129.yukicoder.No723; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num_len = scan.nextInt(); int base_num = scan.nextInt(); int[] num_array = new int[num_len]; int ans_cnt = 0; for (int i = 0; i < num_len; i++) { int a = scan.nextInt(); num_array[i] = a; } Arrays.sort(num_array); for (int i = 0; i < num_len; i++) { int sub = base_num - num_array[i]; if (num_array[i] <= base_num) { for (int j = i; j < num_len; j++) { if (sub == num_array[j]) { if (i == j) ans_cnt += 1; else ans_cnt += 2; } else if (sub < num_array[j]) { break; } } } } System.out.println(ans_cnt); } }