#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define TOSTRING(x) #x #define SZ(x) (int)(x).size() #define REP(i,n) for(int i=0;i<(n);i++) #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REPR(i,n) for(int i=(n)-1;i>=0;i--) #define ALL(s) (s).begin(), (s).end() #define so(V) sort(ALL(V)) #define rev(V) reverse(ALL(V)) #define uni(v) v.erase( unique(ALL(v)) , v.end()); #define PAU system("pause") typedef long long unsigned int llu; typedef long long ll; typedef vector vi; typedef vector vll; typedef vector vb; typedef vector vvi; typedef vector vvll; typedef vector vvb; const double EPS = 1e-9; const int MOD = 1e9 + 7; const int INF = (1 << 30); const double PI = acos(-1); int main() { cin.tie(0); ios::sync_with_stdio(false); int N, X; cin >> N >> X; map M; ll ans = 0; REP(i, N) { int a; cin >> a; ans += M[X - a] * 2; if (a + a == X)ans++; M[a]++; } cout << ans << endl; PAU; return 0; }