#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"class BIT:\n"
"    def __init__(self,n):\n"
"        self.size=n\n"
"        self.tree=[0]*-~n\n"
"    def sum(self,i):\n"
"        s=0\n"
"        while i:\n"
"            s+=self.tree[i]\n"
"            i-=i&-i\n"
"        return s\n"
"    def add(self,i,x):\n"
"        while i<=self.size:\n"
"            self.tree[i]+=x\n"
"            i+=i&-i\n"
"n,k,*a=map(int,open(0).read().split())\n"
"a=[t-k for t in a]\n"
"for i in range(1,n):\n"
"    a[i]+=a[i-1]\n"
"d={}\n"
"for i,v in enumerate(sorted(set(a+[0])),1):\n"
"    d[v]=i\n"
"for i in range(n):\n"
"    a[i]=d[a[i]]\n"
"b=BIT(max(a))\n"
"b.add(d[0],1)\n"
"c=0\n"
"for i,p in enumerate(a):\n"
"    c+=b.sum(p)\n"
"    b.add(p,1)\n"
"print(c)\n"
"\"";
  system(s);
  return 0;
}            