Little Petya likes points a lot. Recently his mom has presented him n points lying on the line OX. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two farthest of them doesn't exceed d.

Note that the order of the points inside the group of three chosen points doesn't matter.

Input

The first line contains two integers: n and d (1 ≤ n ≤ 105; 1 ≤ d ≤ 109). The next line contains n integers x1, x2, ..., xn, their absolute value doesn't exceed 109 — the x-coordinates of the points that Petya has got.

It is guaranteed that the coordinates of the points in the input strictly increase.

Output

Print a single integer — the number of groups of three points, where the distance between two farthest points doesn't exceed d.

Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

Examples

Input

4 3
1 2 3 4


Output

4


Input

4 2
-3 -2 -1 0


Output

2


Input

5 19
1 10 20 30 50


Output

1

Note

In the first sample any group of three points meets our conditions.

In the seconds sample only 2 groups of three points meet our conditions: {-3, -2, -1} and {-2, -1, 0}.

In the third sample only one group does: {1, 10, 20}.
import java.util.*;
import java.io.*;
import java.math.*;


public class Main {
/*



 */
	public static void main(String[] args) throws Exception {
		uu.s1();
		uu.out.close();
	}
	public static class uu {
		public static BR in = new BR();
		public static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		public static boolean bg = true;
		public static void s1() throws Exception {
			int n1 = in.ni();
			int lim = in.ni();
			int[] l1 = in.nil(n1);
			int ptr = 0;
			long fin = 0;
			for (int i = 0; i < l1.length; i++){
				for (;;){
					if (ptr+1< l1.length){
						if (l1[ptr+1] - l1[i]<= lim){
							ptr++;
							continue;
						}
					}
					break;
				}
				int diff = ptr - i;
				if (diff >= 2){
					fin += Comb.choose(diff, 2).longValue();
				}
			}
			pn(fin);
		}
		
		public static void s2() throws Exception {
			
		}
		public static void s3() throws Exception {
			
		}
		
		private static void pn(Object... o1) {
			for (int i = 0; i < o1.length; i++){
				if (i!= 0) out.print(" ");
				out.print(o1[i]);
			}
			out.println();
		}

		public static boolean allTrue(boolean ... l1){
			for (boolean e: l1) if (!e) return false;
			return true;
		}
		public static boolean allFalse(boolean ... l1){
			for (boolean e: l1) if (e) return false;
			return true;
		}
	}
	private static class Comb {
		public static BigInteger bi(long n1){
			return BigInteger.valueOf(n1);
		}
		public static BigInteger factorial(int n1){
			return factorial(n1, n1);
		}
		public static BigInteger factorial(int n1, int k1){
			BigInteger fin = bi(1);
			BigInteger mult = bi(n1);
			for (int i = 0;i<k1;i++){
				fin = fin.multiply(mult);
				mult = mult.subtract(bi(1));
			}
			return fin;
		}
		public static BigInteger choose(int n1, int k1){
			return factorial(n1,k1).divide(factorial(k1));
		}
	}
	
	private static class BR {
		BufferedReader k1 = null;
		StringTokenizer k2 = null;

		public BR() {
			k1 = new BufferedReader(new InputStreamReader(System.in));
		}
		public String nx() throws Exception {
			for (;;) {
				if (k2 == null || !k2.hasMoreTokens()) {
					String temp = k1.readLine();
					if (temp == null)
						return null;
					k2 = new StringTokenizer(temp);
				}
				else
					break;
			}

			return k2.nextToken();
		}

		public int ni() throws Exception {
			return Integer.parseInt(nx());
		}

		public int[] nil(int n1) throws Exception {
			int[] fin = new int[n1];
			for (int i = 0; i < n1; i++) {
				fin[i] = Integer.parseInt(nx());
			}
			return fin;
		}
	}
}

