#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_genius = 0; ngtkana_is_genius < int(n); ngtkana_is_genius++)
#define rep(i, begin, end) for(int i = int(begin); i < int(end); i++)
#define lint long long
auto cmn = [](auto& a, auto b){if (a > b) {a = b; return true;} return false;};
auto cmx = [](auto& a, auto b){if (a < b) {a = b; return true;} return false;};
template <typename T>
std::istream& operator>> (std::istream& is, std::vector<T>& v)
{
  for (auto & x : v) is >> x;
  return is;
}
template <typename InputIterator, typename OutputIterator>
constexpr void
  coenumerate(InputIterator  first,
              InputIterator  last,
              OutputIterator result)
{
  int cnt = 0;
  while (first != last)
  {
    *result = std::make_pair(*first, cnt);
    result++, first++, cnt++;
  }
}

// #define LOCAL
using std::to_string;
auto to_string(std::string s) -> std::string {
  return '"' + s + '"';
}
auto to_string(char c) -> std::string {
  return "'" + std::string{c} + "'";
}
auto to_string(const char* s) -> std::string {
  return to_string((std::string) s);
}
auto to_string(bool b) -> std::string {
  return (b ? "true" : "false");
}
template <typename T, typename U>
auto to_string(std::pair<T, U> p) -> std::string {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <size_t N>
auto to_string(std::bitset<N> bs) -> std::string {
  std::string res{};
  for (size_t i = 0; i < N; i++)
    res.insert(res.begin(), bs.test(i) ? '1' : '0');
  return res;
}
template <typename T>
auto to_string(T v) -> std::string {
  bool flg = false;
  std::string res = "{";
  for (auto const&x : v) {
    if (flg) res += ", ";
    else flg = true;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  std::cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename Value, typename BinaryOp>
class segment_tree
{
  public:
    using size_type      = int;
    using value_type     = Value;
    using function_type  = BinaryOp;
    using container_type = std::vector<value_type>;

  private:
    size_type       n, N;
    function_type   op;
    value_type      id;
    container_type  table;

    void cal (size_type u)
    {
      table.at(u) = op(table.at(2 * u), table.at(2 * u + 1));
    }

  public:
    segment_tree(int size, BinaryOp op, Value id, const std::vector<Value>& v):
      n     (std::pow(2, int(std::log2(size)) + 1)),
      N     (n * 2),
      op    (op),
      id    (id),
      table (N, id)
    {
      assert(n > 0);
      std::move(v.begin(), v.end(), table.begin() + n);
      for (size_type i = n - 1; i != 0; i--) cal(i);
    }

    segment_tree(int size, BinaryOp op, Value id):
      segment_tree(size, std::move(op), id, std::vector<Value>(size, id))
      {}

    auto at (size_type i) const -> value_type
    {
      return table.at(n + i);
    }

    auto collect () const -> std::vector<value_type>
    {
      auto ret = std::vector<value_type>(n);
      for (auto i = 0; i < n; i++)
      {
        ret.at(i) = at(i);
      }
      return ret;
    }

    auto query (size_type l, size_type r) const -> value_type
    {
      struct state {size_type top, left, right;};

      auto ret = id;
      std::stack<state> stk; stk.push({1, 0, n});
      while (!stk.empty())
      {
        auto now = stk.top(); stk.pop();
        if (l <= now.left && now.right <= r)
        {
          ret = op(ret, table.at(now.top));
          continue;
        }
        size_type mid = (now.left + now.right) / 2;
        if (l < mid) stk.push({2 * now.top,     now.left,  mid});
        if (mid < r) stk.push({2 * now.top + 1, mid, now.right});
      }
      return ret;
    }

    void update (size_type u, value_type val)
    {
      table.at(u += n) = val;
      for (u /= 2; u != 0; u /= 2) cal(u);
    }

    void add (size_type u, value_type val)
    {
      update(u, at(u) + val);
    }
};

template<typename Value, typename BinaryOp>
auto make_segment_tree(int size, BinaryOp op, Value vid)
{
  return segment_tree<Value, BinaryOp>(size, std::move(op), vid);
}

template<typename Value, typename BinaryOp>
auto make_segment_tree(int size, BinaryOp op, Value vid, std::vector<int> v)
{
  return segment_tree<Value, BinaryOp>(size, std::move(op), vid, std::move(v));
}

int main()
{
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  int n, k; std::cin >> n >> k;
  std::vector<lint> a(n); std::cin >> a;
  debug(n, k, a);
  for (auto& x : a) x -= k;
  debug(a);
  std::partial_sum(a.begin(), a.end(), a.begin());
  a.insert(a.begin(), 0LL);
  debug(a);
  std::vector<std::pair<lint, int>> pairs(n + 1);
  coenumerate(a.begin(), a.end(), pairs.begin());
  debug(pairs);
  std::sort(pairs.begin(), pairs.end());
  debug(pairs);
  auto sum_tree = make_segment_tree
  (
    n + 1,
    [](auto x, auto y){return x + y;},
    0
  );
  lint ret = 0;
  for (auto pair : pairs)
  {
    auto crr = pair.second;
    ret += sum_tree.query(0, crr);
    sum_tree.update(crr, 1);
  }
  std::cout << ret << std::endl;
  return 0;
}

Measured memory_bytes: 9316