#pragma region kyomukyomupurin

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-05-31 11:20:11
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

#if __cplusplus >= 201703L
template <class Ch, class Tr, class Tuple, std::size_t... Is>
void tuple_out(std::basic_ostream<Ch, Tr>& os, const Tuple& tp, std::index_sequence<Is...>) {
  ((os << (Is ? ", " : "(") << std::get<Is>(tp)), ...) << ")";
}

template <class Ch, class Tr, class... Args>
auto& operator<<(std::basic_ostream<Ch, Tr>& os, const std::tuple<Args...>& tp) {
  tuple_out(os, tp, std::index_sequence_for<Args...>{});
  return os;
}
#endif

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class Compare>
std::ostream& operator<<(std::ostream& os, const std::set<T, Compare>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U, class Compare>
std::ostream& operator<<(std::ostream& os, const std::map<T, U, Compare>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

#pragma endregion kyomukyomupurin

template <class _Tp>
class FenwickTree {
 public:
  FenwickTree(const std::vector<_Tp>& data) : n_(data.size() + 1), data_(data) {
    initialize();
  }

  void add(int pos, _Tp value) {
    ++pos;
    while (pos < n_) {
      node_[pos] += value;
      pos += pos & -pos;
    }
  }

  // return sum of [0, i]
  _Tp get(int pos) {
    ++pos;
    _Tp sum = 0;
    while (pos > 0) {
      sum += node_[pos];
      pos -= pos & -pos;
    }
    return sum;
  }

  // return sum of [l, rihgt]
  _Tp get(int l, int r) { return get(r) - get(l - 1); }

  // return the first k where sum of [0, k] >= value
  // use only when all element in data >= 0
  int lower_bound(_Tp value) {
    if (value <= 0) return 0;
    int pos = 0;
    int k = 1;
    while (k < n_ - 1) k <<= 1;
    while (k > 0) {
      if (pos + k <= n_ - 1 && node_[pos + k] < value) {
        value -= node_[pos + k];
        pos += k;
      }
      k >>= 1;
    }
    return pos;
  }

  // for range add query
  class RAQ {
   public:
    RAQ(const std::vector<_Tp>& data)
        : n_(data.size()),
          ft1_(FenwickTree<_Tp>(data)),
          ft2_(FenwickTree<_Tp>(data)) {}

    // add value range [l, r)
    void add(int l, int r, _Tp value) {
      add(ft1_, l, r, value);
      add(ft2_, l, r, -value * static_cast<_Tp>(l - 1));
      add(ft2_, r, n_, value * static_cast<_Tp>(r - l));
    }

    // get sum of [0, i]
    _Tp get(int pos) {
      return ft1_.get(pos) * static_cast<_Tp>(pos) + ft2_.get(pos);
    }

    // get sum of [l, r]
    _Tp get(int l, int r) { return get(r) - get(l - 1); }

   private:
    int n_;
    FenwickTree<_Tp> ft1_;
    FenwickTree<_Tp> ft2_;
    void add(FenwickTree<_Tp>& ft, int l, int r, _Tp value) {
      ft.add(l, value);
      ft.add(r, -value);
    }
  };

 private:
  int n_;
  std::vector<_Tp> data_;
  std::vector<_Tp> node_;
  void initialize() {
    node_.assign(n_ + 1, 0);
    for (int i = 0; i < n_ - 1; ++i) add(i, data_[i]);
  }
};


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, k; cin >> n >> k;
  vector<int64> a(n); cin >> a;
  for_each(a.begin(), a.end(), [&](int64& e){ e -= k; });
  vector<int64> sum(n + 1, 0);
  for (int i = 1; i < n + 1; ++i) sum[i] = sum[i - 1] + a[i - 1];

  vector<int64> b = sum;
  sort(b.begin(), b.end());
  b.erase(unique(b.begin(), b.end()), b.end());

  FenwickTree<int> ft(vector<int>(n + 1, 0));
  int64 ans = 0;

  for (int i = 0; i < n + 1; ++i) {
    int pos = distance(b.begin(), lower_bound(b.begin(), b.end(), sum[i]));
    ans += ft.get(0, pos);
    ft.add(pos, 1);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 7296