#include <bits/stdc++.h>   template <typename T>   void MACRO_VAR_Scan(T& t) {     std::cin >> t;   }   template <typename First, typename... Rest>   void MACRO_VAR_Scan(First& first, Rest&... rest) {     std::cin >> first;     MACRO_VAR_Scan(rest...);   }   template <typename T>   void MACRO_VEC_ROW_Init(int n, T& t) {     t.resize(n);   }   template <typename First, typename... Rest>   void MACRO_VEC_ROW_Init(int n, First& first, Rest&... rest) {     first.resize(n);     MACRO_VEC_ROW_Init(n, rest...);   }   template <typename T>   void MACRO_VEC_ROW_Scan(int p, T& t) {     std::cin >> t[p];   }   template <typename First, typename... Rest>   void MACRO_VEC_ROW_Scan(int p, First& first, Rest&... rest) {     std::cin >> first[p];     MACRO_VEC_ROW_Scan(p, rest...);   }   template <typename T>   inline T CHMAX(T& a, const T b) {     return a = (a < b) ? b : a;   }   template <typename T>   inline T CHMIN(T& a, const T b) {     return a = (a > b) ? b : a;   }   void CHECKTIME(std::function<void()> f) {     auto start = std::chrono::system_clock::now();     f();     auto end = std::chrono::system_clock::now();     auto res = std::chrono::duration_cast<std::chrono::nanoseconds>((end - start))                    .count();     std::cerr <<  [Time:  << res <<  ns  (  << res / (1.0e9) <<  s)] n ;   }   template <class T>   std::vector<std::vector<T>> VV(int n, int m, T init = T()) {     return std::vector<std::vector<T>>(n, std::vector<T>(m, init));   }   template <typename S, typename T>   std::ostream& operator<<(std::ostream& os, std::pair<S, T> p) {     os <<  (  << p.first <<  ,   << p.second <<  ) ;     return os;   }   using ll = long long;   using ull = unsigned long long;   using ld = long double;   using PAIR = std::pair<ll, ll>;   using PAIRLL = std::pair<ll, ll>;   constexpr ll INFINT = 1 << 30;   constexpr ll INFINT_LIM = (1LL << 31) - 1;   constexpr ll INFLL = 1LL << 60;   constexpr ll INFLL_LIM = (1LL << 62) - 1 + (1LL << 62);   constexpr double EPS = 1e-9;   constexpr ll MOD = 1000000007;   constexpr double PI = 3.141592653589793238462643383279;   template <class T, size_t N>   void FILL(T (&a)[N], const T& val) {     for (auto& x : a) x = val;   }   template <class ARY, size_t N, size_t M, class T>   void FILL(ARY (&a)[N][M], const T& val) {     for (auto& b : a) FILL(b, val);   }   template <class T>   void FILL(std::vector<T>& a, const T& val) {     for (auto& x : a) x = val;   }   template <class ARY, class T>   void FILL(std::vector<std::vector<ARY>>& a, const T& val) {     for (auto& b : a) FILL(b, val);   }   namespace FFT {   const double pi = std::acos(-1);   std::vector<std::complex<double>> tmp;   size_t sz = 1;   std::vector<std::complex<double>> fft(std::vector<std::complex<double>> a,                                         bool inv = false) {     size_t mask = sz - 1;     size_t p = 0;     for (size_t i = sz >> 1; i >= 1; i >>= 1) {       auto& cur = (p & 1) ? tmp : a;       auto& nex = (p & 1) ? a : tmp;       std::complex<double> e = std::polar(1., 2 * pi * i * (inv ? -1 : 1) / sz);       std::complex<double> w = 1;       for (size_t j = 0; j < sz; j += i) {         for (size_t k = 0; k < i; ++k) {           nex[j + k] =               cur[((j << 1) & mask) + k] + w * cur[(((j << 1) + i) & mask) + k];         }         w *= e;       }       ++p;     }     if (p & 1) std::swap(a, tmp);     if (inv)       for (size_t i = 0; i < sz; ++i) a[i] /= sz;     return a;   }   std::vector<ll> mul(std::vector<ll> a, std::vector<ll> b) {     size_t m = a.size() + b.size() - 1;     sz = 1;     while (m > sz) sz <<= 1;     tmp.resize(sz);     std::vector<std::complex<double>> A(sz), B(sz);     for (size_t i = 0; i < a.size(); ++i) A[i].real(a[i]);     for (size_t i = 0; i < b.size(); ++i) B[i].real(b[i]);     A = fft(A);     B = fft(B);     for (size_t i = 0; i < sz; ++i) A[i] *= B[i];     A = fft(A, true);     a.resize(m);     for (size_t i = 0; i < m; ++i) a[i] = std::round(A[i].real());     return a;   }   };  // namespace FFT   signed main() {     std::ios::sync_with_stdio(false);     std::cin.tie(0);     ;     ll n, x;     MACRO_VAR_Scan(n, x);     ;     std::vector<ll> a(n);     for (auto& i : a) std::cin >> i;     ;     for (ll i = 0; i < ll(n); ++i) a[i] = a[i] < x;     std::vector<ll> b;     {       ll cnt = 0;       for (ll i = 0; i < ll(n + 1); ++i) {         if (i == n || a[i]) {           b.emplace_back(cnt);           cnt = 0;         } else {           ++cnt;         }       }     }     ll m = b.size();     {       ll ans = 0;       for (ll i = 0; i < ll(m); ++i) {         ans += (ll)b[i] * (b[i] + 1) / 2;       }       std::cout << (ans);       ;     }     {       for (ll i = 0; i < ll(m); ++i) ++b[i];       auto bb(b);       std::reverse((bb).begin(), (bb).end());       auto c = FFT::mul(b, bb);       std::vector<ll> ans(n, 0);       ll p = 0;       for (ll i = ll(m - 1) - 1; i >= 0; --i) {         ans[p++] = c[i];       }       for (ll i = 0; i < ll(n); ++i) {         std::cout <<    ;         std::cout << (ans[i]);         ;       }       std::cout <<   n ;       ;     }     return 0;   }