let N = Int(readLine()!)!
let M = Int(readLine()!)!
var numbers = readLine()!.split(separator: " ").map{ Int(String($0))! }.sorted()
var start = 0, end = N - 1, answer = 0
while start <. end {
let sum = numbers[start] + numbers[end]
if sum == M {
answer += 1
start += 1
end -= 1
} else if sum > M {
end -= 1
} else {
start += 1
}
}
print(answer)