Good Friends

Time limit1sMemory limit128 MB

Problem

N students' names are given in rank order. Two students are good friends if the difference between their ranks is at most K and their names have the same length.

Write a program that counts the number of pairs of students who are good friends.

Input

The first line contains N and K. (3 <= N <= 300,000, 1 <= K <= N)

Each of the next N lines contains one student's name in rank order. Every name consists only of uppercase English letters and has length between 2 and 20, inclusive.

Output

Print the number of pairs of students who are good friends.