package algorithm_practical;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
public class algo_1940 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer st = new StringTokenizer(br.readLine());
int N = Integer.parseInt(st.nextToken()); // 재료의 개수
st = new StringTokenizer(br.readLine());
int M = Integer.parseInt(st.nextToken()); // 타겟 넘버
int[] J = new int[N];
// 입력 배열 처리
st = new StringTokenizer(br.readLine());
for (int i = 0; i < N; i++) {
J[i] = Integer.parseInt(st.nextToken());
}
Arrays.sort(J);
int sum = 0;
int count = 0;
int start_index = 0;
int end_index = J.length - 1;
//sum의 값이 타켓넘버가 될때까지 한다
while (start_index < end_index) {
sum = J[start_index] + J[end_index];
if (sum < M) {
start_index++;
} else if (sum > M) {
end_index--;
} else {
start_index++;
end_index--;
count++;
}
}
bw.write(String.valueOf(count));
bw.newLine();
bw.flush();
br.close();
bw.close();
}
}