import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        // Reading the size of the array
        int n = scanner.nextInt();

        // Reading the maximum allowed subarray sum limit
        long k = scanner.nextLong();

        // Initialize the array
        long[] b = new long[n];
        for (int i = 0; i < n; i++) {
            b[i] = scanner.nextLong();
        }
        
        long count = 0;
        long currentSum = 0;
		// Left pointer of the sliding window
        int i = 0; 

        // Loop with 'j' acting as the right pointer
        for (int j = 0; j < n; j++) {
            currentSum += b[j];

            // Shrink the window from the left if the sum exceeds k
            while (currentSum > k && i <= j) {
                currentSum -= b[i];
                i++;
            }

            // Count all valid subarrays ending at index j
            count += (j - i + 1);
        }
        
        System.out.println(count);
        scanner.close();
    }
}
