#include using namespace std; #define isin(l, x, r) (l <= x && x < r) #define rep(i, n) for (int i = 0; (i) < (int)(n); ++(i)) #define rep3(i, m, n) for (int i = (m); (i) < (int)(n); ++(i)) #define rep_r(i, n) for (int i = (int)(n) - 1; (i) >= 0; --(i)) #define rep3r(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); --(i)) #define all(x) begin(x), end(x) #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) using ll = long long; using PI = std::pair; using PLL = std::pair; using VI = std::vector; using VLL = std::vector; template using PQ = std::priority_queue, std::greater>; template bool chmax(T &a, const T &b) { if (a < b) { a = b; // aをbで更新 return true; } return false; } template bool chmin(T &a, const T &b) { if (a > b) { a = b; // aをbで更新 return true; } return false; } /* #define rad_to_deg(rad) (((rad)/2/M_PI)*360) cout << std::fixed << std::setprecision(15) << y << endl; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; */ /* #include using namespace atcoder; using mint = modint998244353; */ #include using namespace atcoder; using mint = modint998244353; #ifdef LOCAL #include #else #define dlog(...) #endif ll solve(int N, ll K, const std::vector &A) { auto mx = *max_element(all(A)); VLL a(mx * 2 + 10); rep(i, N) a[A[i]]++; if (K > mx * 2) return 0; auto c = convolution_ll(a, a); return c[K]; } // generated by oj-template v4.8.1 (https://github.com/online-judge-tools/template-generator) int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); cout << std::fixed << std::setprecision(15); int n; ll k; std::cin >> n; std::vector a(n); std::cin >> k; rep(i, n) { std::cin >> a[i]; } auto ans = solve(n, k, a); std::cout << ans << '\n'; return 0; }