#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

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

  int n, x;
  cin >> n >> x;

  vector<int> a(n);
  REP (i, n) cin >> a[i];

  long long ret = 0;
  map<int, int> hist;
  REP (i, n) hist[a[i]]++;
  for (int y: a)
    ret += hist[x-y];
  cout << ret << endl;
  
  return 0;
}