local mfl, mce, mmi = math.floor, math.ceil, math.min
local SegTree = {}
SegTree.updateAll = function(self)
  for i = self.stagenum - 1, 1, -1 do
    for j = 1, self.cnt[i] do
      self.stage[i][j] = self.func(self.stage[i + 1][j * 2 - 1], self.stage[i + 1][j * 2])
    end
  end
end
SegTree.create = function(self, ary, func, emptyvalue)
  self.func, self.emptyvalue = func, emptyvalue
  local stagenum, mul = 1, 1
  self.cnt, self.stage, self.size = {1}, {{}}, {}
  while mul < #ary do
    mul, stagenum = mul * 2, stagenum + 1
    self.cnt[stagenum], self.stage[stagenum] = mul, {}
  end
  for i = 1, stagenum do self.size[i] = self.cnt[stagenum + 1 - i] end
  self.stagenum = stagenum
  for i = 1, #ary do self.stage[stagenum][i] = ary[i] end
  for i = #ary + 1, mul do self.stage[stagenum][i] = emptyvalue end
  self:updateAll()
end
SegTree.getRange = function(self, left, right)
  if left == right then return self.stage[self.stagenum][left] end
  local start_stage = 1
  while right - left + 1 < self.size[start_stage] do
    start_stage = start_stage + 1
  end
  local ret = self.emptyvalue
  local tasks = {{start_stage, left, right}}
  while 0 < #tasks do
    local task = tasks[#tasks]
    table.remove(tasks)
    local stage, l, r = task[1], task[2], task[3]
    if (l - 1) % self.size[stage] ~= 0 then
      local newr = mce((l - 1) / self.size[stage]) * self.size[stage]
      table.insert(tasks, {stage + 1, l, mmi(r, newr)})
      l = newr + 1
    end
    if self.size[stage] <= r + 1 - l then
      local pos = mce(l / self.size[stage])
      ret = self.func(ret, self.stage[stage][pos])
      l = l + self.size[stage]
    end
    if l <= r then
      table.insert(tasks, {stage + 1, l, r})
    end
  end
  return ret
end
SegTree.decValue = function(self, idx, silent)
  self.stage[self.stagenum][idx] = self.stage[self.stagenum][idx] - 1
  if not silent then
    for i = self.stagenum - 1, 1, -1 do
      local dst = mce(idx / 2)
      local rem = dst * 4 - 1 - idx
      self.stage[i][dst] = self.func(self.stage[i + 1][idx], self.stage[i + 1][rem])
      idx = dst
    end
  end
end
SegTree.new = function(ary, func, emptyvalue)
  local obj = {}
  setmetatable(obj, {__index = SegTree})
  obj:create(ary, func, emptyvalue)
  return obj
end

local n, k = io.read("*n", "*n")
local sum, conv = {}, {}
sum[1] = {1, io.read("*n") - k}
for i = 2, n do
  sum[i] = {i, sum[i - 1][2] + io.read("*n") - k}
end
table.sort(sum, function(x, y) return x[2] < y[2] end)
local sumTypeCount = 1
local sumTypeList = {}
do
  conv[sum[1][2]] = 1
  sumTypeList[1] = sum[1][2]
  for i = 2, n do
    if sum[i][2] ~= sumTypeList[sumTypeCount] then
      sumTypeCount = sumTypeCount + 1
      conv[sum[i][2]] = sumTypeCount
      sumTypeList[sumTypeCount] = sum[i][2]
    end
  end
end
table.sort(sum, function(x, y) return x[1] < y[1] end)
local sumArrayForTree = {}
for i = 1, sumTypeCount do sumArrayForTree[i] = 0 end
for i = 1, n do
  sum[i] = sum[i][2]
  local idx = conv[sum[i]]
  sumArrayForTree[idx] = sumArrayForTree[idx] + 1
end

local segtree = SegTree.new(sumArrayForTree, function(a, b) return a + b end, 0)

local function lower_bound(ary, x)
  local num = #ary
  if num == 0 then return 1 end
  if(x <= ary[1]) then return 1 end
  if(ary[num] < x) then return num + 1 end
  local min, max = 1, num
  while(1 < max - min) do
    local mid = mfl((min + max) / 2)
    if(ary[mid] < x) then
      min = mid
    else
      max = mid
    end
  end
  return max
end

local bias = 0
local cnt = 0
for i = 1, n do
  local treeleft = lower_bound(sumTypeList, bias)
  if treeleft <= sumTypeCount then
    cnt = cnt + segtree:getRange(treeleft, sumTypeCount)
  end
  segtree:decValue(conv[sum[i]])
  bias = sum[i]
end
print(cnt)
