#include <bits/stdc++.h>
using namespace std;
long long Data[200010], Sum[200010];
long long N = 0, T = 0, Index = 0;
class SplayNode {
 public:
  SplayNode() : Value(0LL), SSize(1LL), Lson(NULL), Rson(NULL), Fa(NULL) {}
  SplayNode(long long Val)
      : Value(Val), SSize(1LL), Lson(NULL), Rson(NULL), Fa(NULL) {}
  long long Value, SSize;
  SplayNode *Lson, *Rson, *Fa;
  static SplayNode *NewNode(long long Val);
  void Push_Up() {
    long long SSIZE = 1LL;
    if (this->Lson != NULL) SSIZE += this->Lson->SSize;
    if (this->Rson != NULL) SSIZE += this->Rson->SSize;
    this->SSize = SSIZE;
    return;
  }
  void Left_Rotate() {
    SplayNode *y = this->Fa;
    this->Fa = y->Fa;
    if (y->Fa != NULL) {
      if (y->Fa->Lson == y)
        y->Fa->Lson = this;
      else
        y->Fa->Rson = this;
    }
    y->Rson = this->Lson;
    if (this->Lson != NULL) this->Lson->Fa = y;
    this->Lson = y;
    y->Fa = this;
    y->Push_Up();
    this->Push_Up();
    return;
  }
  void Right_Rotate() {
    SplayNode *y = this->Fa;
    this->Fa = y->Fa;
    if (y->Fa != NULL) {
      if (y->Fa->Lson == y)
        y->Fa->Lson = this;
      else
        y->Fa->Rson = this;
    }
    y->Lson = this->Rson;
    if (this->Rson != NULL) this->Rson->Fa = y;
    this->Rson = y;
    y->Fa = this;
    y->Push_Up();
    this->Push_Up();
    return;
  }
  static void Splay(SplayNode *x, SplayNode *s) {
    SplayNode *SF = s->Fa;
    while (x->Fa != SF) {
      SplayNode *y = x->Fa;
      SplayNode *z = y->Fa;
      if (z == SF) {
        if (y->Lson == x)
          x->Right_Rotate();
        else
          x->Left_Rotate();
      } else {
        if (y->Lson == x && z->Lson == y) {
          y->Right_Rotate();
          x->Right_Rotate();
        } else if (y->Rson == x && z->Rson == y) {
          y->Left_Rotate();
          x->Left_Rotate();
        } else if (y->Lson == x && z->Rson == y) {
          x->Right_Rotate();
          x->Left_Rotate();
        } else {
          x->Left_Rotate();
          x->Right_Rotate();
        }
      }
    }
  }
  SplayNode *Insert(long long Val) {
    if (this->Value <= Val) {
      if (this->Rson == NULL) {
        this->Rson = SplayNode::NewNode(Val);
        this->Rson->Fa = this;
        this->Push_Up();
        return this->Rson;
      } else {
        SplayNode *temp = NULL;
        temp = this->Rson->Insert(Val);
        this->Push_Up();
        return temp;
      }
    } else {
      if (this->Lson == NULL) {
        this->Lson = SplayNode::NewNode(Val);
        this->Lson->Fa = this;
        this->Push_Up();
        return this->Lson;
      } else {
        SplayNode *temp = NULL;
        temp = this->Lson->Insert(Val);
        this->Push_Up();
        return temp;
      }
    }
  }
  SplayNode *Get_Succeed(long long Val) {
    if (this->Value > Val) {
      if (this->Lson == NULL) return this;
      SplayNode *temp = NULL;
      temp = this->Lson->Get_Succeed(Val);
      if (temp == NULL)
        return this;
      else
        return temp;
    } else {
      if (this->Rson == NULL)
        return NULL;
      else
        return this->Rson->Get_Succeed(Val);
    }
    return NULL;
  }
  void Output_SplayTree() {
    if (this->Lson != NULL) this->Lson->Output_SplayTree();
    cout << this->SSize << " - " << this->Value << " ";
    if (this->Rson != NULL) this->Rson->Output_SplayTree();
    return;
  }
};
SplayNode Pool[800100];
SplayNode *SplayNode::NewNode(long long Val) {
  SplayNode *temp = &Pool[++Index];
  temp->Value = Val;
  temp->SSize = 1LL;
  temp->Lson = temp->Rson = temp->Fa = NULL;
  return temp;
}
long long Rand(long long L, long long R) {
  return ((long long)rand() * (long long)rand()) % (R - L + 1LL) + L;
}
SplayNode *root = NULL;
void Insert_Node(long long Val) {
  if (root == NULL)
    root = SplayNode::NewNode(Val);
  else {
    SplayNode *temp = NULL;
    temp = root->Insert(Val);
    temp = &Pool[Rand(1, Index)];
    SplayNode::Splay(temp, root);
    root = temp;
  }
  return;
}
int main() {
  srand((unsigned)time(NULL));
  scanf("%I64d%I64d", &N, &T);
  for (register long long i = 1; i <= N; ++i) {
    scanf("%I64d", &Data[i]);
    Sum[i] = Sum[i - 1] + Data[i];
  }
  long long Ans = 0;
  SplayNode *temp = NULL;
  for (register long long i = N; i >= 0; --i) {
    if (root != NULL) {
      temp = NULL;
      temp = root->Get_Succeed(Sum[i] + T - 1);
      if (temp == NULL) {
        if (root != NULL) Ans += root->SSize;
        Insert_Node(Sum[i]);
        continue;
      }
      SplayNode *mid = root;
      SplayNode::Splay(temp, root);
      root = temp;
      if (root->Lson != NULL) Ans += root->Lson->SSize;
      SplayNode::Splay(mid, root);
      root = mid;
    }
    Insert_Node(Sum[i]);
  }
  printf("%I64d\n", Ans);
  return 0;
}
