#line 1 "h.cpp" #include #line 2 "library/src/stream.hpp" #include #include #include namespace kyopro { /** * 整数の入出力 */ template constexpr inline void readint(T& a) { a = 0; bool is_negative = false; char c = getchar_unlocked(); while (isspace(c)) { c = getchar_unlocked(); } if (c == '-') is_negative = true, c = getchar_unlocked(); while (isdigit(c)) { a = 10 * a + (c - '0'); c = getchar_unlocked(); } if (is_negative) a *= -1; } template constexpr inline void readint(Head& head, Tail&... tail) { readint(head); readint(tail...); } template void write_int(T a) { if (!a) { putchar_unlocked('0'); putchar_unlocked('\n'); return; } if (a < 0) putchar_unlocked('-'), a *= -1; char s[37]; int now = 37; while (a) { s[--now] = (char)'0' + a % 10; a /= 10; } while (now < 37) putchar_unlocked(s[now++]); } template constexpr inline void putint(T a) { if (!a) { putchar_unlocked('0'); putchar_unlocked('\n'); return; } if (a < 0) putchar_unlocked('-'), a *= -1; char s[37]; int now = 37; while (a) { s[--now] = (char)'0' + a % 10; a /= 10; } while (now < 37) putchar_unlocked(s[now++]); putchar_unlocked('\n'); } template constexpr inline void putint(Head head, Tail... tail) { putint(head); putint(tail...); } /** * 文字列の入出力 */ void readstr(std::string& str) { char c = getchar_unlocked(); while (isspace(c)) c = getchar_unlocked(); while (!isspace(c)) { str += c; c = getchar_unlocked(); } } void putstr(const std::string& str) { for (auto c : str) { putchar_unlocked(c); } putchar_unlocked('\n'); } }; // namespace kyopro /** * @brief fastIO */ #line 2 "library/src/template.hpp" #include #define rep(i, N) for (int i = 0; i < (N); i++) #define all(x) std::begin(x), std::end(x) #define popcount(x) __builtin_popcountll(x) using i128 = __int128_t; using ll = long long; using ld = long double; using graph = std::vector>; using P = std::pair; constexpr int inf = 1e9; constexpr ll infl = 1e18; constexpr ld eps = 1e-6; const long double pi = acos(-1); constexpr uint64_t MOD = 1e9 + 7; constexpr uint64_t MOD2 = 998244353; constexpr int dx[] = {1, 0, -1, 0}; constexpr int dy[] = {0, 1, 0, -1}; template constexpr inline bool chmax(T1& a, T2 b) { return a < b && (a = b, true); } template constexpr inline bool chmin(T1& a, T2 b) { return a > b && (a = b, true); } #line 4 "h.cpp" using namespace std; using namespace kyopro; int main() { int n, x; readint(n, x); vector a((int)1e5 + 1); rep(i, n) { int v; readint(v); ++a[v]; } a = atcoder::convolution_ll(a, a); putint(a[x]); }