EasyRating 900
Teams of Three
A student may join the contest at most 5 times. Student i has already taken part y_i times. How many teams of three can be formed so that each team can still take part k more times together?
Input
n and k, then n integers.
Output
One integer.
Sample 1
Input
5 2 0 4 5 1 0
Output
1
Sample 2
Input
6 4 0 1 2 3 4 5
Output
0
Output appears here