403101: GYM101005 D Take5

Memory Limit:6 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Take5time limit per test2 secondsmemory limit per test6 megabytesinputstandard inputoutputstandard output

Pay attention to the memory limit for this problem!

You are given an array A of size N and a positive integer S. You need to find the number of ways W in which you can chose 5 elements with distinct positions such that their sum is equal to S.

Input

The first line contains two positive integer N,  S (1 ≤ N ≤ 103,  0 ≤ S ≤ 2 * 109) - the size of the array and the queried sum.

The next line contains N numbers Ai (0 ≤ Ai ≤ 4 * 108,  1 ≤ i ≤ N).

Output

Print the only integer W (0 ≤ W < 231) - the number of ways to chose the elements.

ExampleInput
6 5
1 1 1 1 1 1
Output
6

加入题单

上一题 下一题 算法标签: