#include <bits/stdc++.h>

#define st first
#define nd second
#define com make_pair 
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define mem(x, v) memset(x, v, sizeof(x))
#define rep(x, n) for (int x = 0      ; x <  (n); ++x)
#define per(x, n) for (int x = (n) - 1; i >= 0  ; --x)
#define exc(x, a, b) for (auto x = (a); x <  (b); ++x)
#define inc(x, a, b) for (auto x = (a); x <= (b); ++x)
#define cxe(x, a, b) for (auto x = (b) - 1; x >= (a); --x)
#define cni(x, a, b) for (auto x = (b)    ; x >= (a); --x)
#define debug(x) cerr <<__LINE__ << " " << #x << " = " << x << endl;

using namespace std;

const int mod = (int) 1e9 + 7;

typedef long long ll;
typedef vector<int> vi;
typedef double dbl;
typedef pair<int, int> mti;

namespace math {
  inline void add(int &a, int b, int p = mod) {
    a + b >= p ? a = a + b - p : a = a + b;
  }
  inline void sub(int &a, int b, int p = mod) {
    a - b < 0 ? a = a - b + p : a = a - b;
  }
  inline int mul(int a, int b, int p = mod) {
    return (long long) a * b % p;
  }
  inline int modexp(int a, int x, int p = mod) {
    int res = 1;
    for (; x; x >>= 1) {
      if (x & 1) {
        res = mul(res, a, p);
      }
      a = mul(a, a, p);
    }
    return res;
  }
};
using namespace math;

namespace io {
  template <typename T = int>
  inline T read() {
    T x = 0;
    int f = 1;
    char ch = cin.get();
    for (; !isdigit(ch) && !cin.eof(); cin.get(ch)) {
      f = (ch == '-') ? -1 : 1;
    }
    for (; isdigit(ch) && !cin.eof(); cin.get(ch)) {
      x = x * 10 + ch - '0';
    }
    return f * x;
  }

  template <typename T = int>
  inline void write(T x, char ch = '\n') {
    static char stk[255];
    static int top = 0;
    if (x < 0) {
      cout.put('-');
      x = -x;
    }
    if (x == 0) {
      cout.put('0');
      cout.put(ch);
      return;
    }
    top = 0;
    while (x) {
      stk[top++] = x % 10 + '0';
      x /= 10;
    }
    while (top) {
      cout.put(stk[--top]);
    }
    cout.put(ch);
  }
}
using namespace io;

template<typename T>
struct arr {
  T *a;
  int n;
  void clear(){
    n = 0;
  }
  arr<T>& operator << (T x) {
    if ((n & -n) == n) {
      T *b = a;
      a = new T[n << 1];
      copy(b, b + n, a);
    }
    a[n++] = x;
    return *this;
  }
  T& operator [] (int x) {
    return a[x];
  }
  inline T* begin() {
    return a;
  }
  inline T* end() {
    return a + n;
  }
};

const int N = 2e5 + 5;

int n;
int k;
int a[N];

long long sum[N];

bool cmp(const int &a, const int &b) {
  ll va = sum[a] - (long long) a * k;
  ll vb = sum[b] - (long long) b * k;
  return va == vb ? a < b : va < vb;
}

class fenwick {
public:

  int a[N];

  void add(int x) {
    ++x;
    for (; x <= n; x += x & -x) {
      a[x]++;
    }
  }

  int sum(int x) {
    int res = 0;
    ++x;
    for (; x; x -= x & -x) {
      res += a[x];
    }
    return res;
  }
} f;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  n = read();
  k = read();
  rep (i, n) {
    a[i] = read();
  }
  sum[0] = a[0];
  exc (i, 1, n) {
    sum[i] = sum[i - 1] + a[i];
  }
  arr<pair<long long, int> > id;
  rep (i, n) {
    id << com(sum[i] - (long long) i * k, i);
  }

  sort(all(id));

  ll ans = 0;

  rep (i, n) {
    int v = id[i].second;
    ans = ans + f.sum(v);
    if (sum[v] / (v + 1) >= k) {
      ++ans;
    }
    f.add(v);
  }
  write(ans);
  
  flush(cout);
  return 0;
}


Measured memory_bytes: 11648