#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e6;
const long long M = 1e9 + 7, inf = 1e18;
const char nl = '\n';
long long apbmc(long long a, long long b, long long c) {
  a %= c;
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % c;
    a = a * a % c;
    b >>= 1;
  }
  return res;
}
long long apb(long long x, long long y) {
  long long temp;
  if (y == 0) return 1;
  temp = apb(x, y / 2);
  if (y % 2 == 0)
    return temp * temp;
  else
    return temp * temp * x;
}
void solve() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int &i : v) cin >> i;
  int ans = 0;
  unordered_map<int, int> um;
  for (int i = 0; i < n; i++) {
    if (um[abs(v[i] - k)]) ans++;
    um[v[i]]++;
  }
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}
