← Home
```go
package main

import (
	"fmt"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	counts := make([]int, 6)
	for i := 0; i < n; i++ {
		var y int
		fmt.Scan(&y)
		counts[y]++
	}

	// A person with y participations can still participate 5-y more times
	// For a team to participate together at least k times, each member needs at least k remaining participations
	// So each member must have y <= 5-k, i.e., remaining >= k
	
	eligible := 0
	for y := 0; y <= 5-k; y++ {
		eligible += counts[y]
	}

	fmt.Println(eligible / 3)
}
```