The Saratov State University Olympiad Programmers Training Center (SSU OPTC) has n students. For each student you know the number of times he/she has participated in the ACM ICPC world programming championship. According to the ACM ICPC rules, each person can participate in the world championship at most 5 times.

The head of the SSU OPTC is recently gathering teams to participate in the world championship. Each team must consist of exactly three people, at that, any person cannot be a member of two or more teams. What maximum number of teams can the head make if he wants each team to participate in the world championship with the same members at least k times?


-----Input-----

The first line contains two integers, n and k (1 ≤ n ≤ 2000; 1 ≤ k ≤ 5). The next line contains n integers: y_1, y_2, ..., y_{n} (0 ≤ y_{i} ≤ 5), where y_{i} shows the number of times the i-th person participated in the ACM ICPC world championship.


-----Output-----

Print a single number — the answer to the problem.


-----Examples-----
Input
5 2
0 4 5 1 0

Output
1

Input
6 4
0 1 2 3 4 5

Output
0

Input
6 5
0 0 0 0 0 0

Output
2



-----Note-----

In the first sample only one team could be made: the first, the fourth and the fifth participants.

In the second sample no teams could be created.

In the third sample two teams could be created. Any partition into two teams fits.

Source: codeforces | Difficulty: EASY
Tags: Sorting

Implementation

Greedy algorithms


Solutions:
(A, B) = list(map(int, input().split()))
Arreglo1 = list(map(int, input().split()))
suma = 0
for k in range(A):
	if Arreglo1[k] + B <= 5:
		suma += 1
print(suma // 3)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
(l, r) = (0, n)
while r - l > 1:
	m = (r + l) // 2
	if a[m] > 5 - k:
		r = m
	else:
		l = m
print((l + 1) // 3)


n_k = input()
lines = input()
lines = lines.split(' ')
lines.sort()
(num_pers, times_to_participe) = n_k.split(' ')
num_pers = int(num_pers)
times_to_participe = int(times_to_participe)
sets = num_pers // 3
less_than = 5 - times_to_participe
c = 0
set_possible = 0
for set in range(0, sets):
	for number in lines:
		if int(number) <= less_than and c < 3:
			c += 1
	if c == 3:
		set_possible += 1
	c = 0
	lines = lines[3:]
print(set_possible)


(n, k) = map(int, input().split())
players = [int(c) for c in input().split()]
limit = 5 - k
coN = 0
for p in players:
	if p <= limit:
		coN += 1
print(coN // 3)


(n, k) = map(int, input().split())
l = [int(i) for i in input().split()]
l.sort()
l1 = list(filter(lambda i: i + k <= 5, l))
print(len(l1) // 3)


def solve(arr, n, k):
	(i, res) = (0, 0)
	arr.sort(reverse=True)
	while i < n - 2:
		while arr[i] == 5:
			i += 1
		if i < n - 2 and arr[i] + k <= 5 and (arr[i + 1] + k <= 5) and (arr[i + 2] + k <= 5):
			arr[i] += k
			arr[i + 1] += k
			arr[i + 2] += k
			res += 1
			i += 3
		else:
			i += 1
	return res
(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
print(solve(arr, n, k))


(n, k) = map(int, input().split())
s = map(int, input().split())
c = 0
for x in s:
	if x <= 5 - k:
		c += 1
print(c // 3)


(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
new_lst = []
for i in lst:
	if i + k <= 5:
		new_lst.append(i)
if len(new_lst) < 3:
	print(0)
else:
	print(len(new_lst) // 3)


(n, k) = map(int, input().split())
s = str(6 - k)
print(sum((i < s for i in input()[::2])) // 3)


value = input()
(n, k) = value.split()
n = int(n)
k = int(k)
values = input()
values = values.split()
values = [int(i) + k <= 5 for i in values]
print(sum(values) // 3)


(n, k) = map(int, input().split(' '))
members = list(map(int, input().split(' ')))
members.sort()
count = 0
for member in members:
	if member <= 5 - k:
		count = count + 1
	else:
		break
print(count // 3)


import re
(n, k) = [int(x) for x in input().split()]
arr = ''.join(input().split())
arr = re.sub('5', '', arr)
arr = re.sub('[6-9]', '', str(int('1' + arr) + int(str(k) * len(arr)))[1:])
print(len(arr) // 3)


students_times = input()
student_participations = input()
students = int(students_times.split()[0])
times = int(students_times.split()[1])
lst = student_participations.split()
new_list = list()
for participations in lst:
	participations = int(participations)
	if participations <= 5 - times:
		new_list.append(participations)
print(int(len(new_list) / 3))


(n, k) = [int(word) for word in input().split()]
arr = [int(word) for word in input().split()]
count = 0
for year in arr:
	if year + k - 1 < 5:
		count += 1
answer = count // 3
print(answer)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(2, n, 3):
	if 5 - a[i] >= k:
		ans += 1
print(ans)


(n, k) = input().split()
(n, k) = (int(n), int(k))
l = list(map(int, input().split()))
c = 0
for i in range(n):
	if l[i] + k <= 5:
		c += 1
print(c // 3)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
c = []
c.extend(a)
ctr = 0
for i in range(n):
	c[i] = c[i] + k
for i in range(n):
	if c[i] <= 5:
		ctr += 1
print(ctr // 3)


(n, k) = [int(x) for x in input().split()]
L = [int(x) for x in input().split()]
num = 0
for i in L:
	i = i + k
	if i <= 5:
		num = num + 1
print(num // 3)


(n, k) = map(int, input().split())
ls = [int(a) for a in input().split()]
ls.sort()
an = 0
for i in range(n):
	if 5 - ls[i] < k:
		break
	an = i
print((an + 1) // 3)


maximum_no_of_attempts = 5
list_of_n_k = list(map(int, input().split(' ')))
n = list_of_n_k[0]
k = list_of_n_k[1]
y = list(map(int, input().split(' ')))
number_to_check = 5 - k
number_of_participants = 0
for i in y:
	if i <= number_to_check:
		number_of_participants = number_of_participants + 1
print(number_of_participants // 3)


(n, m) = input().split(' ')
n = int(n)
m = int(m)
c = []
k = 0
a = input().split(' ')
for i in range(n):
	a[i] = int(a[i])
for i in range(n):
	if a[i] <= 5 - m:
		c.append(a[i])
		k += 1
print(k // 3)


s1 = input().split(' ')
n = int(s1[0])
k = int(s1[1])
k = 5 - k
s = input().split(' ')
s = [int(i) for i in s]
s = sorted(s)
l = 0
for i in range(n):
	if s[i] <= k:
		s[i] = 5
		l += 1
l = l / 3
l = int(l)
print(l)


(n, m) = list(map(int, input().split(' ')))
ps = list(map(int, input().split(' ')))
print(len([1 for p in ps if p + m <= 5]) // 3)


__author__ = 'Dilshod'
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
cnt = 0
for i in range(0, n - 2, 3):
	if a[i] + k <= 5 and a[i + 1] + k <= 5 and (a[i + 2] + k <= 5):
		cnt += 1
	else:
		break
print(cnt)


(n, k) = map(int, input().split())
time = [int(x) for x in input().split()]
ok = sum((x + k <= 5 for x in time))
print(ok // 3)


(n, k) = map(int, input().split())
L = [int(i) for i in input().split()]
L.sort()
t = 0
for i in range(n):
	if L[n - i - 1] <= 5 - k:
		m = i
		p = n - m
		ans = int(p / 3)
		print(ans)
		break
	else:
		t += 1
if t == n:
	print(0)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
s = 0
for i in a:
	if i + k <= 5:
		s += 1
print(s // 3)


(n, k) = map(int, input().split())
y = [int(i) for i in input().split()]
can = []
for i in y:
	if 5 - i >= k:
		can.append(i)
print(int(len(can) / 3))


(n, k) = map(int, input().split())
c = [int(x) + k for x in input().split()]
t = 0
for i in c:
	if i <= 5:
		t += 1
print(t // 3)


(n, k) = map(int, input().split())
x = list(map(int, input().split()))
e = 5 - k
c = 0
for i in range(len(x)):
	if x[i] <= e:
		c = c + 1
print(c // 3)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = [i for i in a if i <= 5 - k]
print(len(a) // 3)


(n, k) = map(int, input().split())
b = []
a = list(map(int, input().split()))
for i in range(n):
	if a[i] + k <= 5:
		b.append(a[i])
print(len(b) // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
p = [i for i in l if i <= 5 - k]
print(len(p) // 3)


(n, k) = map(int, input().split())
list2 = []
list1 = list(map(int, input().split()))
for i in list1:
	if 5 - i >= k:
		list2.append(i)
print(len(list2) // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
a = []
for i in l:
	if 5 - i >= k:
		a.append(i)
if len(a) < 3:
	print(0)
else:
	if len(a) % 3 == 0:
		x = len(a) // 3
	else:
		x = len(a) // 3
	print(x)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
numTeam = 0
y.sort()
for i in range(n):
	y[i] = 5 - y[i]
	y[i] = y[i] // k
y.sort()
while y[n - 1] != 0:
	for i in range(n):
		if y[i] > 0:
			if i + 1 < n and i + 2 < n:
				y[i] = 0
				y[i + 1] = 0
				y[i + 2] = 0
				numTeam += 1
			else:
				y[n - 1] = 0
print(numTeam)


a = input().split()
n = int(a[0])
k = int(a[1])
b = map(int, input().split())
b = map(lambda x: x + k, b)
counter = 0
for i in b:
	if i <= 5:
		counter += 1
overall = counter // 3
print(overall)


(n, k) = map(int, input().split())
b = list(map(int, input().split()))
kolvo = 0
chi = 0
chelovek = 0
for i in range(len(b)):
	chi = 0
	while b[i] < 5:
		b[i] += 1
		chi += 1
		if chi == k:
			chelovek += 1
			chi = 0
			break
	if chelovek == 3:
		kolvo += 1
		chelovek = 0
print(kolvo)


(n, k) = [int(x) for x in input().split()]
data = [int(x) for x in input().split() if int(x) <= 5 - k]
print(len(data) // 3)


(a1, a2) = map(int, input().split())
l = list(map(int, input().split()))
c = 0
for i in range(a1):
	l[i] += a2
for ele in l:
	if ele <= 5:
		c += 1
print(c // 3)


(n, k) = map(int, input().split())
a = sorted(list(map(int, input().split())))
r = 5 - k
s = 0
for i in range(0, r + 1):
	s += a.count(i)
print(s // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
count = 0
for i in range(n):
	if y[i] < 5 and y[i] + k <= 5:
		count += 1
print(count // 3)


(n, m) = map(int, input().split())
t = list(map(int, input().split()))
y = [6 - t[i] - m for i in range(n)]
cou = 0
for i in range(n):
	if y[i] < 1:
		cou += 1
print((n - cou) // 3)


(n, k) = [int(x) for x in input().split()]
allowed = 5 - k
acms = [int(x) for x in input().split()]
c = 0
for value in acms:
	c += value <= allowed
print(c // 3)


(n, k) = map(int, input().split())
li = [int(x) for x in input().split()]
ncount = 0
for num in li:
	if num + k <= 5:
		ncount += 1
print(ncount // 3)


(a, b) = list(map(int, input().split()))
m = [int(x) for x in input().split(' ')]
count = 0
for i in range(a):
	if m[i] + b <= 5:
		count += 1
print(count // 3)


nk = input().split()
for i in range(0, 2):
	nk[i] = int(nk[i])
y = input().split()
s = 0
for i in range(0, len(y)):
	y[i] = int(y[i])
	if 5 - y[i] >= nk[1]:
		s += 1
print(int(s / 3))


(n, k) = map(int, input().split())
mem = list(map(int, input().split()))
nt = 0
for i in range(n):
	if mem[i] + k <= 5:
		nt = nt + 1
print(int(nt / 3))


(_, k) = map(int, input().split())
l = list(map(int, input().split()))
ctn = 0
for v in l:
	if v <= 5 - k:
		ctn += 1
print(ctn // 3)


bot = True
P = lambda : map(int, input().split())
(_, k) = P()
print(sum((x <= 5 - k for x in P())) // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
y.sort()
count = 0
for i in range(len(y)):
	if y[i] <= 5 - k:
		count += 1
	else:
		break
print(count // 3)


(n, k) = map(int, input().split())
members = input().split()
can_members = []
for i in members:
	if 5 - int(i) >= k:
		can_members.append(int(i))
ans = len(can_members) // 3
print(ans)


(m, n) = map(int, input().split())
l = []
lst = sorted(list(map(int, input().split())))
for i in lst:
	if i + n <= 5:
		l.append(i)
print(int(len(l) / 3))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
porog = 5 - k
print((a.count(porog) + a.count(porog - 1) + a.count(porog - 2) + a.count(porog - 3) + a.count(porog - 4)) // 3)


(n, k) = map(int, input().split())
numbers = list(map(int, input().split()))
for i in range(n):
	numbers[i] += k
count = len([x for x in numbers if x <= 5])
print(count // 3)


n = str(input())
k = input()
nn = n.split(' ')
kk = k.split(' ')
k1 = 0
x = []
for i in range(0, int(nn[0])):
	if int(kk[k1 + i]) + int(nn[1]) <= 5:
		x.insert(i, 'a')
xy = len(x) / 3
print(int(xy))


(n, k) = [int(u) for u in input().split(' ')]
l = [int(y) for y in input().split(' ')]
m = []
for i in l:
	h = 5 - i
	m.append(h)
n = []
c = 0
for j in m:
	if j >= k:
		n.append(j)
print(len(n) // 3)


(n, k) = map(lambda x: int(x), input().split())
num = input()
list = [int(x) for x in num.split()]
for i in list[:]:
	if i > 5 - k:
		list.remove(i)
w = len(list) // 3
print(w)


(n, k) = [int(x) for x in input().split()]
li = [int(x) for x in input().split()]
li.sort()
t = len(li)
k = 5 - k
i = 0
co = 0
for i in range(t):
	if li[i] <= k:
		co = co + 1
	else:
		break
print(co // 3)


s = list(input().split(' '))
a = list(input().split(' '))
c = 0
for i in a:
	if int(i) <= 5 - int(s[1]):
		c = c + 1
print(int(c / 3))


(n, k) = map(int, input().split())
ans = 0
arr = [int(x) for x in input().split()]
for x in arr:
	if x + k <= 5:
		ans += 1
print(ans // 3)


(n, k) = map(int, input().split())
lis = [int(x) for x in input().split()]
lis2 = [x + k for x in lis]

def is_large(n):
	return n <= 5
lis3 = list(filter(is_large, lis2))
print(len(lis3) // 3)


t = input()
(n, k) = t.split(' ')
students = input()
new_stud = []
for x in students.split(' '):
	new_stud.append(int(x))
new_stud = sorted(new_stud)
no_teams = int(n) // 3
count = 0
teams = 0
for x in range(3, int(n) + 1, 3):
	flag = 0
	for y in new_stud[x - 3:x]:
		if y + int(k) > 5:
			flag = 1
			break
	if flag == 1:
		break
	else:
		teams += 1
print(teams)


(n, k) = map(int, input().split())
teams = 0
members = list(map(int, input().split()))
count = 0
members_avail = []
for i in range(0, len(members)):
	if members[i] <= 5 - k:
		members_avail.append(members[i])
a = len(members_avail)
while a >= 3:
	a -= 3
	teams += 1
print(teams)


x = input().split(' ')
req = int(x[1])
teams = input().split(' ')
for i in range(len(teams)):
	teams[i] = int(teams[i])
teams.sort()
if len(teams) < 3:
	print(0)
else:
	end = 2
	count = 0
	while end < len(teams):
		counter = max(teams[end - 2], teams[end - 1], teams[end])
		if counter < 5 and 5 - counter >= req:
			count += 1
		end += 3
	print(count)


(n, m) = map(int, input().split(' '))
l = list(map(int, input().split(' ')))
c = 0
l.sort()
for i in range(n):
	if l[i] + m <= 5:
		c += 1
	else:
		break
print(c // 3)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
l = []
for i in a:
	if i <= 5 - k:
		l.append(i)
print(len(l) // 3)


(n, k) = [int(i) for i in input().split()]
geeks = sorted([int(i) for i in input().split()])
part = n
for (i, geek) in enumerate(geeks):
	if geek > 5 - k:
		part = i
		break
print(part // 3)


(n, k) = map(int, input().split())
array = list(map(int, input().split()))
c = -1
for i in range(n):
	c += 1
	for j in range(n - c):
		if array[j] + k > 5:
			array.remove(array[j])
			break
d = len(array)
if d < 3:
	print('0')
else:
	print(d // 3)


(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
rs = 0
for i in range(5 - k + 1):
	rs += arr.count(i)
print(int(rs / 3))


(N, K) = map(int, input().split())
lst = list(map(int, input().split()))[:N]
newL = []
new = []
for i in lst:
	newL += [i + K]
new = [i for i in newL if i <= 5]
if len(new) % 3 == 0:
	print(int(len(new) / 3))
if len(new) % 3 != 0:
	for x in range(len(new), 0, -1):
		x -= 1
		if x % 3 == 0:
			print(int(x / 3))
			break


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
for i in a:
	if i == 5:
		a.remove(i)
i = 0
while i < len(a):
	if 5 - a[i] < k:
		del a[i]
	else:
		i += 1
print(len(a) // 3)


def clean(list, k):
	i = 0
	while i < len(list):
		if list[i] > 5 - k:
			list.remove(list[i])
			i -= 1
		i += 1
(n, k) = map(int, input().split())
list1 = list(map(int, input().split()))
clean(list1, k)
count = len(list1) // 3
print(count)


(n, k) = map(int, input().split())
a = list(map(int, input().rstrip().split()))
new = list(filter(lambda x: x + k <= 5, a))
print(len(new) // 3)


(n, k) = map(int, input().split())
c = 0
a = [int(a) for a in input().split()]
for i in a:
	if i + k <= 5:
		c += 1
print(int(c / 3))


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))[:n]
arr.sort(reverse=False)
teamNum = 0
for i in range(int(n / 3)):
	if 5 - arr[3 * (i + 1) - 1] >= k:
		teamNum = teamNum + 1
print(teamNum)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
count = 0
for i in range(0, n):
	if 5 - a[i] >= k:
		count += 1
print(count // 3)


from sys import stdin
(n, k) = map(int, stdin.readline().split())
array = list(map(int, stdin.readline().split()))
array2 = [i + k for i in array if i + k < 6]
print(len(array2) // 3)


nk = input().split()
n = int(nk[0])
k = int(nk[1])
lst = list(map(int, input().rstrip().split()))
c = 0
for i in range(n):
	if lst[i] + k <= 5:
		c += 1
print(c // 3)


(n, k) = input().split()
n = int(n)
k = int(k)
l = list(map(int, input().split()))
t = 5 - k
h = list(filter(lambda x: x <= t, l))
print(len(h) // 3)


(n, d) = map(int, input().split(' '))
mas = list(map(int, input().split(' ')))
res = 0
for i in mas:
	if 5 - i >= d:
		res += 1
print(res // 3)


(no_of_stds, atleast_participation) = map(int, input().split())
std_participation = list(map(int, input().split()))
print(len([std for std in std_participation if std <= 5 - atleast_participation]) // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()[:n]))
s = len(y)
t = 0
p = 0
for i in range(s):
	if y[i] + k <= 5:
		t = t + 1
		if t == 3:
			p = p + 1
			t = 0
print(p)


import sys
it = iter(sys.stdin.read().splitlines())
(n, k) = [int(x) for x in next(it).split(' ')]
students = [int(x) for x in next(it).split(' ')]
students.sort()
maxInitial = 5 - k
available = 0
for student in students:
	if student <= maxInitial:
		available += 1
result = available // 3
print(result)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
count = 0
temp = []
for i in range(len(arr)):
	if 5 - int(arr[i]) >= k:
		count = count + 1
		temp.append(int(arr[i]))
print(len(temp) // 3)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
c = 0
test = 5 - k
for i in range(n):
	if a[i] <= test:
		c = c + 1
print(c // 3)


def f(n):
	r = 1
	for i in range(2, n + 1):
		r *= i
	return r

def c(n, r):
	return f(n) // (f(r) * f(n - r))
(n, k) = [int(x) for x in input().split()]
veces = [int(x) for x in input().split()]
valids = sum([1 if x <= 5 - k else 0 for x in veces])
print(valids // 3)


s = input().split()
n = int(s[0])
k = int(s[1])
s = input().split()
cnt = 0
for i in s:
	if int(i) + k <= 5:
		cnt += 1
print(cnt // 3)


(n, k) = map(int, input().split())
c = 0
p = 0
l = list(map(int, input().split()))
l.sort()
for j in range(len(l)):
	l[j] = 5 - l[j] - k
for i in range(len(l)):
	if l[i] >= 0:
		c = c + 1
	if c == 3:
		p = p + 1
		c = 0
print(p)


(n, k) = list(map(int, input().split()))
lst = list(map(int, input().split()))
mini = 5 - k
res = 0
for i in lst:
	if i <= mini:
		res += 1
print(res // 3)


def main():
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	arr = [i for i in arr if i <= 5 - k]
	if len(arr) < 3:
		print(0)
	else:
		print(len(arr) // 3)
main()


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
count = 0
for i in range(0, n - 2, 3):
	if arr[i] + k <= 5 and arr[i + 1] + k <= 5 and (arr[i + 2] + k <= 5):
		count += 1
print(count)


(n, k) = map(int, input().split())
tp = list(map(int, input().split()))
teams = [i for i in tp if 5 - k >= i]
print(len(teams) // 3)


(size, time) = input().split()
ls = list(map(int, input().split()))
count = 0
for i in ls:
	if i + int(time) <= 5:
		count += 1
print(int(count / 3))


(n, k) = [int(x) for x in input().split()]
times = [int(x) for x in input().split()]
pop = 0
for x in times:
	if x + k <= 5:
		pop += 1
print(pop // 3)


(n, k) = map(int, input().split())
matches = [int(x) for x in input().split()]
matches.sort()
i = 2
answer = 0
while i <= n - 1:
	if matches[i] + k <= 5:
		answer += 1
		i += 3
	else:
		break
print(answer)


a = input().split(' ')
total = int(a[0])
lower = int(a[1])
upper = 6
a = input().split(' ')
count = 0
for i in a:
	i = int(i)
	if i + lower < upper:
		count = count + 1
print(count // 3)


def choosingTeams(n, k, li):
	temp = []
	for i in li:
		if k <= 5 - i:
			temp.append(i)
	return len(temp) // 3
(n, k) = input().split()
li = [int(x) for x in input().split()]
print(choosingTeams(int(n), int(k), li))


import sys
parametrs = list(map(int, input().split()))
n = parametrs[0]
k = parametrs[1]
players = list(map(int, input().split()))
games = []
for player in players:
	count_games = 5 - player - k
	if count_games >= 0:
		games.append(count_games)
print(len(games) // 3)


(n, k) = map(int, input().split())
l = [int(x) for x in input().split()]
m = len([x for x in l if x <= 5 - k])
print(m // 3)


(n, m) = map(int, input().split())
l = map(int, input().split())
counter = 0
team = 0
for i in l:
	if 5 - i >= m:
		team += 1
		if team == 3:
			counter += 1
			team = 0
print(counter)


ans = 0
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
p = []
while len(a) > 0:
	if a[0] + k > 5:
		a.pop(0)
	else:
		p.append(a[0])
		a.pop(0)
print(len(p) // 3)


(n, k) = list(map(int, input().strip().split(' ')))
nums = list(map(int, input().strip().split(' ')))
maxa = 5 - k
ans = 0
for num in nums:
	if num <= maxa:
		ans += 1
print(ans // 3)


(n, k) = [int(x) for x in input().split()]
arrs = [int(x) for x in input().split()]
print(sum((x <= 5 - k for x in arrs)) // 3)


(n, k) = map(int, input().split())
par = list(map(int, input().split()))
par = sorted(par)
teams = 0
for i in range(0, n, 3):
	if i + 1 < n and i + 2 < n:
		pl1 = par[i] + k
		pl2 = par[i + 1] + k
		pl3 = par[i + 2] + k
		if pl1 <= 5 and pl2 <= 5 and (pl3 <= 5):
			teams += 1
print(teams)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
otv = []
for i in range(n):
	if 5 - a[i] >= k:
		otv.append(a[i])
if len(otv) < 3:
	print(0)
else:
	k = len(otv)
	print(k // 3)


(n, k) = (int(i) for i in input().split())
s = [int(i) for i in input().split()]
todel = []
for i in s:
	if i > 5 - k:
		todel.append(i)
for i in todel:
	s.remove(i)
print(len(s) // 3)


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)
from math import ceil, floor, log, sqrt, factorial

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
(n, k) = get_ints()
Arr = get_array()
Arr.sort()
count = 0
for i in range(2, n, 3):
	if Arr[i] <= 5 - k:
		count += 1
print(count)


(n, k) = map(int, input().split())
y = [int(i) for i in input().split()]
c = 0
for j in y:
	if k + j <= 5:
		c = c + 1
print(c // 3)


b = [int(i) for i in input().split(' ')]
n = b[0]
k = b[1]
f = 0
a = [int(n) for n in input().split(' ')]
for i in range(len(a)):
	if a[i] <= 5 - k:
		f = f + 1
print(f // 3)


(m, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
li = []
for e in l:
	if e <= 5 - k:
		li.append(e)
if len(li) < 3:
	print(0)
else:
	print(len(li) // 3)


import math
s = 0
(n, k) = map(int, input().split())
l = list(map(int, input().strip().split()))[:n]
l.sort()
for i in l:
	f = i + k
	if i < 5 and f <= 5:
		s = s + 1
res = math.floor(s / 3)
print(res)


(n, k) = list(map(int, input().split()))
li = list(map(int, input().split()))
li.sort()
(i, count) = (0, 0)
while i <= int(n / 3) and 3 * i + 2 < n:
	if li[3 * i + 2] + k <= 5:
		count += 1
	else:
		break
	i += 1
print(count)


(players, num) = list(map(int, input().split()))
participated = list(map(int, input().split()))
new = participated.copy()
for i in range(players):
	a = participated[i]
	if a > 5 - num:
		new.remove(a)
print(len(new) // 3)


(n, k) = map(int, input().split())
people = map(int, input().split())
ans = 0
for person in people:
	if 5 - person >= k:
		ans += 1
print(ans // 3)


(n, k) = map(int, input().split())
v = list(map(int, input().split()))
t = 0
for i in v:
	if 5 - i >= k:
		t += 1
print(t // 3)


x = input().split()
a = int(x[0])
b = int(x[1])
x = input().split()
emon = []
for i in x:
	c = int(i)
	emon.append(c)
emon.sort()
p = len(emon) % 3
if p == 1:
	emon.pop()
elif p == 2:
	emon.pop()
	emon.pop()
sum = 0
for i in range(0, len(emon), 3):
	l = emon[i]
	j = emon[i + 1]
	k = emon[i + 2]
	if l + b <= 5 and j + b <= 5 and (k + b <= 5):
		sum += 1
print(sum)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
y_new = [x + k for x in y]
y_available = [x for x in y_new if x <= 5]
print(len(y_available) // 3)


l1 = [int(i) for i in input().split(' ')]
l2 = [int(i) for i in input().split(' ')]
count = 0
for i in l2:
	if i + l1[1] <= 5:
		count += 1
print(count // 3)


(N, K) = map(int, input().split())
Y = list(map(int, input().split()))
cnt = 0
for i in range(0, N):
	if 5 - Y[i] >= K:
		cnt += 1
print(cnt // 3)


(n, k) = map(int, input().split())
past = [int(i) for i in input().split()]
able = [i for i in past if i + k <= 5]
ans = len(able) // 3
print(ans)


(n, k) = map(int, input().split())
time = [5 - y for y in list(map(int, input().split()))]
time.sort()
fail = 0
while fail < n and time[fail] < k:
	fail += 1
print((n - fail) // 3)


k = int(input().split()[1])
print(sum((i <= 5 - k for i in map(int, input().split()))) // 3)


new = input().split()
n = int(new[0])
k = int(new[1])
x = n // 3
lst = input().split()
lst1 = list()
for i in range(n):
	lst1.append(int(lst[i]))
lst1.sort()
lst2 = list()
for i in range(x):
	lst2.append(lst1[i * 3:(i + 1) * 3])
team = 0
for i in range(x):
	if max(lst2[i]) + k <= 5:
		team += 1
print(team)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
p = 5 - k
i = 0
l = 0
for i in range(0, len(a)):
	if a[i] <= p:
		l += 1
	else:
		break
print(l // 3)


(n, k) = [int(x) for x in input().split()]
l = [int(x) // (6 - k) for x in input().split()]
print(l.count(0) // 3)


from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
import sys, bisect, math, itertools, fractions, pprint
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7
mod2 = 998244353
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpln(n):
	return list((int(sys.stdin.readline()) for i in range(n)))
(n, k) = inpl()
a = inpl()
a.sort()
res = 0
for i in range(2, n)[::3]:
	if a[i] + k <= 5:
		res += 1
print(res)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
x = 0
for i in range(6 - k):
	c = a
	x += c.count(i)
print(x // 3)


(a, b) = input().split()
a = int(a, 10)
b = int(b, 10)
l = 0
s = input().split()
for i in range(len(s)):
	s[i] = int(s[i])
	k = 5 - s[i]
	if k >= b:
		l = l + 1
print(int(l / 3))


import math
import sys
import heapq
from collections import deque, defaultdict
from itertools import permutations, combinations, combinations_with_replacement
import random
import os
mod = 10 ** 9 + 7
MAX = sys.maxsize
MIN = -sys.maxsize - 1

def isPrime(n):
	if n > 1:
		for i in range(2, n):
			if n % i == 0:
				return False
		else:
			return True
	else:
		return False

def isPanagram(s):
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	for char in alphabet:
		if char not in s.lower():
			return False
	return True

def isEqual(list1):
	if len(list1) < 0:
		res = True
	res = all((ele == list1[0] for ele in list1))
	if res:
		return True
	else:
		return False

def remove_duplicate(list1):
	final_list = []
	for i in list1:
		if i not in final_list:
			final_lis.append(i)
	return final_list

def solve():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	count = 0
	if isEqual(a) and a[0] <= 1:
		return n // 3
	for i in range(n):
		if a[i] + k <= 5:
			count += 1
	return count // 3
print(solve())


(n, k) = list(map(int, input().split(' ')))
arr = list(map(int, input().split(' ')))
available_participant = 0
for i in arr:
	if i + k <= 5:
		available_participant += 1
print(available_participant // 3)


(n, k) = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
nb_students = sum((i <= 5 - k for i in y))
print(int(nb_students / 3))


from itertools import groupby
(_, k) = map(int, input().split())
students = list(map(int, input().split()))
s = [len(list(group)) for (key, group) in groupby(students) if k + key < 6]
print(sum(s) // 3)


def main():
	(_, n) = map(int, input().split())
	y = list(map(int, input().split()))
	print(len([i + n for i in y if i + n <= 5]) // 3)
main()


(n, k) = list(map(int, input().split()))
nums = list(map(int, input().split()))
count = 0
for x in nums:
	if x + k <= 5:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
participated_times = list(map(int, input().split()))
available = [x + k for x in participated_times if x + k <= 5]
print(len(available) // 3)


(n, k) = map(int, input().split())
list1 = list(map(int, input().split()))
count = 0
for l in range(n):
	if list1[l] + k <= 5:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
value_first_ele_not_allowed = 5 - k + 1
ans = []
for i in range(n):
	if arr[i] < value_first_ele_not_allowed:
		ans.append(arr[i])
	else:
		break
print(int(len(ans) / 3))


from bisect import bisect_left

def solve(n, k, y):
	y = list(map(lambda x: 5 - x, y))
	y.sort()
	return (len(y) - bisect_left(y, k)) // 3

def main():
	(n, k) = list(map(int, input().split()))
	y = list(map(int, input().split()))
	print(solve(n, k, y))
main()


(a, b) = map(int, input().split())
l = list(map(int, input().strip().split()))
t = 0
for i in l:
	if i <= 5 - b:
		t += 1
print(int(t / 3))


(n, k) = map(int, input().split())
num_of_times = list(map(int, input().split()))
team = []
for i in range(n):
	if num_of_times[i] + k <= 5:
		team.append(num_of_times[i])
if len(team) < 3:
	print(0)
else:
	print(len(team) // 3)


(_, times) = [int(x) for x in input().strip().split(' ')]
(members, sum_out) = (input().strip(), 0)
for x in range(0, 6 - times):
	sum_out += members.count(str(x))
print(int(sum_out / 3))


(n, k) = input().split()
(n, k) = (int(n), int(k))
lst = [int(x) for x in input().split()]
x = 0
for i in range(len(lst)):
	if lst[i] + k <= 5:
		x = x + 1
print(x // 3)


(_, k) = list(map(int, input().split()))
print(sum([i <= 5 - k for i in list(map(int, input().split()))]) // 3)


(n, k) = map(int, input().split())
a = input('')
l = list(a.split())
l = sorted([int(x, 10) for x in l])
index_ = 0
for i in range(0, len(l)):
	if l[i] <= 4:
		l[i] = l[i] + k
		if l[i] <= 5:
			index_ = i
	else:
		break
index_ = index_ + 1
print(index_ // 3)


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
num = 0
for i in range(n):
	if a[i] + k <= 5:
		num += 1
print(num // 3)


(n, k) = map(int, input().split())
member = list(map(int, input().split()))
member.sort()
count = 0
for i in range(n):
	if member[i] <= 5 - k:
		count += 1
print(count // 3)


(n, m) = map(int, input().split())
s = list(map(int, input().split()))
com = 5 - m
c = 0
for i in s:
	if i <= com:
		c = c + 1
print(c // 3)


(n, k) = map(int, input().split())
members = [int(x) for x in input().split()]
members.sort()
ans = 0
i = 0
while 3 * i <= n - 3:
	if max(members[3 * i:3 * i + 3]) <= 5 - k:
		ans += 1
	else:
		ans = ans
	i += 1
print(ans)


(n, k) = str(input()).split()
n = int(n)
k = int(k)
line = str(input()).split()
line = [int(it) for it in line]
value = 0
k = 5 - k
for i in range(n):
	if line[i] <= k:
		value += 1
print(int(value / 3))


(n, k) = map(int, input().split())
s = input()
s = s.split()
lst = list()
if len(s) == n:
	for i in s:
		i = int(i) + k
		if i <= 5:
			lst.append(i)
	print(len(lst) // 3)


(students, timesTeam) = map(int, input().split())
timesIndi = list(map(int, input().split()))
timesIndi.sort()
i = students - 1
while i >= 0:
	timesIndi[i] += timesTeam
	if timesIndi[i] >= 6:
		timesIndi.pop()
	i -= 1
print(len(timesIndi) // 3)


(n, k) = map(int, input().split())
arr = sorted(map(int, input().split()))
teams = 0
for i in range(0, n, 3):
	if len(arr[i:i + 3]) == 3 and max(arr[i:i + 3]) + k <= 5:
		teams += 1
print(teams)


(n, k) = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
sum = 0
for i in range(6 - k):
	sum += y.count(i)
print(sum // 3)


l = input().split()
(n, k) = (int(l[0]), int(l[1]))
l = input().split()
arr = [int(x) for x in l]
holderArr = [0] * 6
for i in arr:
	holderArr[i] += 1
count = 0
for i in range(6 - k):
	count += holderArr[i]
print(int(count / 3))


z = input
(a, b) = z().split()
b = int(b)
l = z().split()
p = []
for i in l:
	if b + int(i) <= 5:
		p.append(i)
print(len(p) // 3)


(n, y) = map(int, input().split())
x = [int(q) for q in input().split()]
a = 0
for i in range(len(x)):
	if 5 - x[i] >= y:
		a += 1
print(a // 3)


(n, k) = map(int, input().split())
count = 0
a = list(map(int, input().strip().split()))[:n]
for i in range(n):
	if a[i] <= 5 - k:
		count += 1
print(int(count / 3))


(_, k) = map(int, input().split())
membrs = map(int, input().split())
membrs = filter(lambda x: 5 - x >= k, membrs)
print(len(list(membrs)) // 3)


(a, b) = map(int, input().split())
list1 = list(map(int, input().split()))
count = 0
for i in range(len(list1)):
	diff = 5 - list1[i]
	if diff >= b:
		count = count + 1
print(count // 3)


x = input()
xx = x.split()
n = int(xx[0])
k = int(xx[1])
x = input()
xx = x.split()
j = 5 - k
g = 0
for i in xx:
	if int(i) <= j:
		g += 1
print(int(g // 3))


def main():
	num_list = input().split(' ')
	temp_list = input().split(' ')
	k = int(num_list[1])
	n = int(num_list[0])
	del num_list
	main_list = []
	for i in range(n):
		main_list.append(int(temp_list[i]))
	main_list.sort()
	del temp_list
	main_list[:] = [i + k for i in main_list]
	final_list = []
	for i in range(int(n)):
		if main_list[i] <= 5:
			final_list.append(main_list[i])
	del main_list
	result = len(final_list) // 3
	print(result)
	del final_list
main()


(n, m) = input().strip().split()[:2]
n = int(n)
m = int(m)
count = 0
l = list(map(int, input().strip().split()[:n]))
for x in l:
	if x <= 5 - m:
		count += 1
print(count // 3)


a = list(map(int, input().split()))
n = a[0]
k = a[1]
b = list(map(int, input().split()))
count = 0
for i in b:
	if i <= 5 - k:
		count += 1
p = count
print(p // 3)


(n, k) = list(map(int, input().split()))
y = list(map(int, input().split()))
max = 5 - k
print(sum([1 for i in y if i <= max]) // 3)


f = lambda : map(int, input().split(' '))
(n, k) = f()
a = list(f())
for i in range(n):
	a[i] = 5 - a[i]
c = 0
for i in a:
	if i >= k:
		c += 1
print(c // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
c = 0
a = []
for i in range(len(l)):
	if l[i] + k <= 5:
		a.append(l[i])
		if len(a) == 3:
			c += 1
			a.clear()
print(c)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
m = 5 - k
ans = 0
for x in range(0, n):
	if a[x] <= m:
		ans += 1
ans = ans / 3
print(int(ans))


(a, b) = map(int, input().split())
c = [int(s) for s in input().split()]
c.sort()
s = 0
for k in c:
	if k + b <= 5:
		s += 1
print(s // 3)


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()[:n]]
cnt = 0
f = 0
for i in range(n):
	x = 5 - a[i]
	if x >= k:
		cnt += 1
while cnt >= 3:
	f += 1
	cnt -= 3
print(f)


(n, k) = map(int, input().split())
list = list(map(int, input().split()))
b = 0
for i in list:
	if i + k < 6:
		b += k
print(int(b / (k * 3)))


import sys
(n, k) = map(int, input().split())
a = map(int, input().split())
print(len([x for x in a if x + k <= 5]) // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l = [x + k for x in l]
d = []
for x in l:
	if x <= 5:
		d.append(x)
print(len(d) // 3)


str1 = input().split(' ')
cantidad = int(str1.pop())
n = int(str1.pop())
str2 = input().split(' ')
counter = 0
for i in range(n):
	participante = int(str2[i])
	if participante + cantidad <= 5:
		counter += 1
print(counter // 3)


def func(n):
	k = list(map(int, input().split()))
	counter = 0
	times_to_participate = n[1]
	for i in range(len(k)):
		if 5 - k[i] >= times_to_participate:
			counter += 1
	print(counter // 3)
n = list(map(int, input().split()))
func(n)


import math
(a, b) = input().split()
l = list(map(int, input().split()))
count = 0
for i in range(int(a)):
	if l[i] < 6 - int(b):
		count += 1
print(math.floor(count / 3))


(n, k) = map(int, input().split())
m = map(int, input().split())
f = list(m)
v = 0
for i in range(n):
	if f[i] <= 5 - k:
		v += 1
print(v // 3)


(x, y) = map(int, input().split())
t = input().split()
s = []
d = 0
for i in t:
	s.append(int(i))
for i in range(len(s)):
	s[i] += y
	if s[i] <= 5:
		d += 1
print(d // 3)


x = input()
y = input()
x = x.split(' ')
y = y.split(' ')
x = [int(i) for i in x]
y = [int(i) for i in y]
count = 0
for i in y:
	if x[1] + i <= 5:
		count += 1
count = int(count / 3)
print(count)


(n, k) = map(int, input().split())
mem = list(map(int, input().split()))
c = 0
team = 0
for i in mem:
	if abs(i - 5) >= k:
		c += 1
		if c == 3:
			team += 1
			c = 0
print(team)


counte = 0
teams = 0
(n, k) = map(int, input().split(' '))
members = list(map(int, input().split(' ')))
for i in range(n):
	if 5 - members[i] >= k and counte < 3:
		counte += 1
	if counte == 3:
		teams += 1
		counte = 0
print(teams)


(n, k) = map(int, input().split())
people = teams = 0
y = [int(i) for i in input().split()]
for i in y:
	if i <= 5 - k:
		people += 1
print(people // 3)


(N, K) = map(int, input().split())
Y = list(map(int, input().split()))
Y = [y + K for y in Y]
cnt = sum([1 if y <= 5 else 0 for y in Y])
ans = cnt // 3
print(ans)


(n, k) = input().split()
y = [int(x) for x in input().split()]
z = sorted(y)
flag = 0
for i in range(0, int(n)):
	if 5 - y[i] >= int(k):
		flag += 1
print(int(flag / 3))


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [i + m for i in a]
b = [i for i in b if i <= 5]
print(len(b) // 3)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for x in a:
	if 5 - x >= k:
		ans += 1
ans //= 3
print(ans)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
ans = 0
for i in range(0, len(arr) // 3):
	if 5 - arr[i * 3 + 2] >= k:
		ans += 1
	else:
		break
print(ans)


(n, l) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
p = n // 3
count = 0
i = 0
j = 1
k = 2
while p > 0:
	b = [a[i], a[j], a[k]]
	if 5 - a[k] >= l:
		count += 1
	i += 3
	j += 3
	k += 3
	p -= 1
print(count)


isDebug = False
(n, k) = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
y = sorted(y)
t = 0
i = 2
while i < n:
	print(f'i={i}') if isDebug else ''
	y1 = y[i - 2]
	y2 = y[i - 1]
	y3 = y[i]
	d1 = 5 - y1
	d2 = 5 - y2
	d3 = 5 - y3
	if d1 >= k and d2 >= k and (d3 >= k):
		t = t + 1
		i = i + 3
	else:
		i = i + 1
print(f'{t}')


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
c = 0
for num in a:
	if num + k <= 5:
		c += 1
print(c // 3)


(n, k) = map(int, input().split())
y = sum((i <= 5 - k for i in map(int, input().split())))
print(y // 3)


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
m.sort()
count = 0
for i in range(2, len(m), 3):
	if m[i] + k <= 5:
		count += 1
print(count)


(n, k) = map(int, input().split(' '))
ppl = list(map(int, input().split(' ')))
qualified = [person for person in ppl if person + k <= 5]
print(len(qualified) // 3)


(n, k) = list(map(int, input().split(' ')))
students = list(map(int, input().split(' ')))
count = 0
students = [s + k for s in students]
students = list(filter(lambda x: x <= 5, students))
count += len(students) // 3
print(count)


(n, k) = input().split()
n = int(n)
k = int(k)
l = list(map(int, input().split()))
l.sort()
while len(l) % 3 != 0:
	l.append(6)
	n = n + 1
count = 0
i = 2
while i < n:
	if l[i] + k <= 5:
		count += 1
	i = i + 3
print(count)


(n, k) = [int(x) for x in input().split()]
times = [int(x) for x in input().split()]
for i in times:
	if i > 5 - k:
		n -= 1
print(int(n / 3))


(n, k) = map(int, input().rstrip().split())
l = list(map(int, input().rstrip().split()))
print(sum((1 for i in l if i <= 5 - k)) // 3)


(n, k) = [int(x) for x in input().split()]
l = [int(x) + k for x in input().split()]
s = l.count(0) + l.count(1) + l.count(2) + l.count(3) + l.count(4) + l.count(5)
print(int(s / 3))


(n, k) = map(int, input().split())
y = map(int, input().split())
remainder = [5 - yi for yi in y]
possible = sum([ri >= k for ri in remainder]) // 3
print(possible)


(n, k) = list(map(int, input().split()))
y = sorted(list(map(int, input().split())))
answer = 0
for i in y:
	if i + k <= 5:
		answer += 1
	else:
		break
print(answer // 3)


(n, k) = input().split()
k = int(k)
y = input().split()
t = 0
for i in y:
	if k + int(i) <= 5:
		t = t + 1
print(t // 3)


(n, k) = map(int, input().split())
listt = [None] * n
listt = list(map(int, input().split()))
listt.sort()
res = 0
i = 0
while i < n:
	if n - i >= 3:
		if listt[i] + k <= 5 and listt[i + 1] + k <= 5 and (listt[i + 2] + k <= 5):
			res = res + 1
			i = i + 3
		else:
			i = i + 3
	else:
		break
print(res)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
s.sort()
d = 5 - k
i = 0
while s[i] <= d:
	i += 1
	if i == n:
		break
print(i // 3)


from itertools import combinations, permutations
k = [int(x) for x in input().split()]
m = [int(x) for x in input().split()]
m.sort()
l = []
for i in m:
	if i <= 5 - k[1]:
		l.append(i)
print(int(len(l) / 3))


import math
import os
import random
import re
import sys
ab = input().split()
a = ab[0]
b = ab[1]
puzzle = [int(1) if int(x) + int(b) <= 5 else int(10) for x in input().split()]
count = puzzle.count(1)
teams = count // 3
print(teams)


def team():
	listFinal = []
	i = input()
	(n, k) = i.split()
	n = int(n)
	k = int(k)
	y = list(map(int, input().strip().split()))[:n]
	y.sort()
	for x in y:
		if int(x) + k <= 5:
			listFinal.append(x)
		if int(x) + k > 5:
			break
	num = len(listFinal)
	print(int(num / 3))

def main():
	team()
main()


l = list(map(int, input().strip().split()))
arr = list(map(int, input().strip().split()))
n = l[0]
k = l[1]
count = 0
for i in arr:
	if i <= 5 - k:
		count = count + 1
print(count // 3)


(a, b) = map(int, input().split())
q = 0
w = 0
s = list(map(int, input().split()))
for i in s:
	if i + b <= 5:
		q += 1
	if q == 3:
		w = w + 1
		q = 0
print(w)


import sys
from random import choice, randint
inp = sys.stdin.readline
out = sys.stdout.write
flsh = sys.stdout.flush
sys.setrecursionlimit(10 ** 9)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def MI():
	return map(int, inp().strip().split())

def LI():
	return list(map(int, inp().strip().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

def LI_():
	return [int(x) - 1 for x in inp().strip().split()]

def LF():
	return [float(x) for x in inp().strip().split()]

def LS():
	return inp().strip().split()

def I():
	return int(inp().strip())

def F():
	return float(inp().strip())

def S():
	return inp().strip()

def pf(s):
	return out(s + '\n')

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	(n, k) = MI()
	y = LI()
	c = 0
	for i in y:
		if i <= 5 - k:
			c += 1
	pf(str(c // 3))
main()


st = input().split()
n = int(st[0])
k = int(st[1])
t = map(int, input().split())
total = 0
for j in t:
	if j + k <= 5:
		total += 1
print(total // 3)


(n, k) = map(int, input().split())
g = []
o = []
b = 5
z = 0
for i in range(n):
	a = map(int, input().split())
	g += a
	break
for u in g:
	if u <= b - k:
		o.append(u)
z = int(len(o) / 3)
print(z)


def f():
	(x, y) = map(int, input().split())
	li = list(map(int, input().split()))
	li.sort()
	c = 0
	m = 3 * (len(li) // 3) - 1
	ind = 2
	while ind <= m:
		if li[ind] + y <= 5:
			c += 1
		ind += 3
	print(c)
f()


(a, b) = input().split()
b = int(b)
list1 = list(input().split())
list1 = sorted(list1)
count = 0
for i in list1:
	i = int(i)
	if 5 - b >= i:
		count += 1
print(int(count / 3))


(n, k) = input().split()
n = int(n)
k = int(k)
a = [int(i) + k for i in input().split()]
summ = 0
for i in a:
	if i <= 5:
		summ += 1
print(summ // 3)


(m, k) = map(int, input().split())
li = list(map(int, input().split()))
pair = 0
count = 0
for i in li:
	if i + k <= 5:
		pair += 1
		if pair == 3:
			pair = 0
			count += 1
print(count)


(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
count = 0
for i in range(n):
	arr[i] += k
arr.sort()

def function(e):
	return e <= 5
for i in range(0, len(arr), 3):
	if len(list(filter(function, arr[i:i + 3]))) == 3:
		count += 1
print(count)


(n, k) = map(int, input().split())
l1 = list(map(int, input().split()))
c = 0
for item in l1:
	if 5 - item >= k:
		c += 1
print(c // 3)


from math import *

def solve(lst, x):
	count = 0
	lst2 = []
	for i in range(len(lst)):
		if lst[i] + x <= 5:
			lst2.append(lst[i])
	if len(lst2) % 3 == 0:
		count += len(lst2) / 3
	else:
		count += floor(len(lst2) / 3)
	return int(count)
(n, k) = list(map(int, input().split()))
students = list(map(int, input().split()))
print(solve(students, k))


(n, k) = map(int, input().split())
arr = [i for i in input().split() if int(i) + k <= 5]
print(len(arr) // 3)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	(n, k) = LI()
	l = LI()
	cnt = 0
	for x in l:
		if x + k <= 5:
			cnt += 1
	return cnt // 3
print(main())


(n, k) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
l.sort()
i = 0
while i < len(l):
	if l[i] + k <= 5:
		i += 1
	else:
		break
print(i // 3)


(n, k) = input().split()
(n, k) = (int(n), int(k))
years = [int(x) for x in input().split()]
ans = sum([1 for x in years if x + k <= 5])
print(ans // 3)


(x, y) = input().split()
a = int(x)
b = int(y)
hello = list()
hello1 = list()
hello = [int(x) for x in input().split()]
hello = sorted(hello)
c = 5 - b
for i in hello:
	if i <= c:
		hello1.append(i)
d = len(hello1)
print(int(d / 3))


(n, k) = map(int, input().split())
arr = list(map(int, input().strip().split()))
arr.sort()
flag = 1
res = 0
i = 0
while flag and i + 2 < n:
	if 5 - arr[i] >= k and 5 - arr[i + 1] >= k and (5 - arr[i + 2] >= k):
		res += 1
		i += 3
	else:
		break
print(res)


(n, k) = map(int, input().split())
y = [int(i) for i in input().split()]
p = 0
for i in y:
	if i <= 5 - k:
		p += 1
print(p // 3)


(n, m) = [int(j) for j in input().split()]
nums = [int(j) for j in input().split()]
count = 0
for j in range(n):
	if nums[j] + m <= 5:
		count += 1
print(int(count / 3))


(n, k) = [int(i) for i in input().split()]
sutable = 0
for i in [int(i) for i in input().split()]:
	if 5 - i >= k:
		sutable += 1
print(sutable // 3)


p = input()
p = p.split()
n = int(p[0])
k = int(p[1])
q = input()
q = q.split()
l = []
for i in range(n):
	if int(q[i]) + k <= 5:
		l.append(int(q[i]))
if len(l) > 2:
	print(len(l) // 3)
else:
	print(0)


a = [int(x) for x in input().split()]
n = a[0]
k = a[1]
w = []
s = [int(x) for x in input().split()]
t = 5 - k
for i in range(n):
	if s[i] <= t:
		w.append(s[i])
print(int(len(w) / 3))


(n, k) = map(int, input().split())
x = list(map(int, input().split()))
ct = 0
for i in x:
	if 5 - i >= k:
		ct = ct + 1
res = ct // 3
print(res)


(n, k) = map(int, input().split())
s = [6 - int(i) for i in input().split()]
t = 0
for i in s:
	if i > k:
		t += 1
print(int(t / 3))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
print(sum(map(lambda o: int(o + k <= 5), a)) // 3)


s = input('')
(n, k) = s.split(' ')
n = int(n)
k = int(k)
s1 = input('')
l = s1.split(' ')
l = list(map(int, l))
count = 0
for i in l:
	i = i + k
	if i <= 5:
		count += 1
if count < 3:
	print('0')
elif count % 3 == 0:
	print(count // 3)
else:
	while count % 3 != 0:
		count = count - 1
	print(count // 3)


(n, k) = map(int, input().split())
y = [int(num) for num in input().split()]
a = list(filter(lambda p: p <= 5 - k, y))
print(len(a) // 3)


(n, k) = map(int, input().split())
l = input().split()
br = 0
for item in l:
	if int(item) + k <= 5:
		br += 1
print(br // 3)


from collections import defaultdict

def main():
	(n, k) = map(int, input().split())
	arr = list(input().split())
	d = defaultdict(int)
	for i in arr:
		d[i] += 1
	ans = 0
	for i in range(5 - k + 1):
		ans += d[str(i)]
	print(ans // 3)
main()


__author__ = 'myduomilia'
(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
print(len([val for val in arr if val + k <= 5]) // 3)


(n, a) = map(int, input().split())
m = list(map(int, input().split()))
ans = 0
for i in range(6 - a):
	ans += m.count(i)
ans //= 3
print(ans)


(n, m) = [int(i) for i in input().split()]
ls = [int(i) for i in input().split()]
count = 0
for i in ls:
	if i + m <= 5:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
c = 0
for i in a:
	if i + k < 6:
		c += 1
print(c // 3)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
i = 2
ans = 0
while i < n:
	if a[i] + k <= 5:
		ans += 1
	i += 3
print(ans)


(a, b) = input().split()
arr = list(map(int, input().split()))
a = int(a)
b = int(b)
d = 5 - b
e = 0
for i in arr:
	if i <= d:
		e = e + 1
e = e // 3
print(e)


(n, k) = map(int, input().split())
my_list = sorted(list(map(int, input().split())))
n_of_possible_teams = n // 3
counter = 0
for i in range(n_of_possible_teams):
	if my_list[2 + 3 * i] <= 5 - k:
		counter += 1
	else:
		break
print(counter)


def solve(ys, k):
	return sum((1 for y in ys if y + k <= 5)) // 3

def main():
	[n, k] = [int(i) for i in input().strip().split()]
	ys = [int(i) for i in input().strip().split()]
	assert len(ys) == n
	result = solve(ys, k)
	print(result)
main()


(n, k) = map(int, input().split())
y = sorted([int(_) for _ in input().split()])
g = 0
for i in y:
	if i < 5 and i + k <= 5:
		g += 1
print(g // 3)


(n, k) = map(int, input().split())
person_list = list(map(int, input().split()))
(cnt, ans) = (0, 0)
for i in range(0, 6 - k):
	cnt += len(list(filter(lambda x: x is i, person_list)))
print(cnt // 3)


(n, k) = map(int, input().split())
l = map(int, input().split())
l2 = []
for i in l:
	i += k
	if i <= 5:
		l2.append(i)
print(len(l2) // 3)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a0 = a.count(0)
a1 = a.count(1)
a2 = a.count(2)
a3 = a.count(3)
a4 = a.count(4)
ans = a0 + a1 + a2 + a3 + a4
if k == 2:
	ans -= a4
elif k == 3:
	ans -= a4 + a3
elif k == 4:
	ans -= a4 + a3 + a2
elif k == 5:
	ans = a0
print(int(ans // 3))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
count = 0
for i in l:
	if i + k <= 5:
		count += 1
	else:
		break
print(count // 3)


(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
count = 0
for a in lst:
	if a <= 5 - k:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
a = sorted(list(map(int, input().split())))
m = 5 - k
res = 0
for i in range(2, n, 3):
	if a[i] <= m and a[i - 2] <= m:
		res += 1
	else:
		break
print(res)


(a, b) = input().split()
(n, k) = (int(a), int(b))
v = input().split()
l = []
for el in v:
	l.append(int(el) + k)
nr = 0
for el in l:
	if el <= 5:
		nr += 1
print(nr // 3)


(n, k) = map(int, input().split())
d = list(map(int, input().split()))
u = []
for i in range(n):
	if 5 - d[i] >= k:
		u.append(5 - d[i])
m = len(u)
print(m // 3)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
sum = 0
for i in range(len(a)):
	if a[i] + k <= 5:
		sum += 1
print(sum // 3)


a = input().split()
n = int(a[0])
k = int(a[1])
b = input().split()
x = 0
while x < len(b):
	b[x] = int(b[x])
	x = x + 1
x = 0
b.sort()
while x < len(b):
	b[x] = int(5 - b[x])
	x = x + 1
x = 0
y = 0
while x < len(b):
	if b[x] >= k:
		y = y + 1
	x = x + 1
z = y // 3
print(int(z))


(n, k) = tuple(map(int, input().split()))
y = list(map(int, input().split()))
y_mod = [i + k for i in y if i + k <= 5]
print(len(y_mod) // 3)


(n, k) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
z = 0
for i in range(n):
	a[i] -= 5
	if abs(a[i]) >= k:
		z += 1
print(z // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
count = sum((x <= 5 - k for x in y))
print(count // 3)


(n, k) = (int(i) for i in input().split())
members = [int(i) + k for i in input().split()]
res = 0
for i in members:
	if i <= 5:
		res += 1
print(int(res / 3))


(n, k) = map(int, input().split())
cnt = int(0)
for x in input().split():
	if int(x) <= 5 - k:
		cnt += 1
print(cnt // 3)


[n, k] = [int(item) for item in input().split(' ')]
remains = [int(item) for item in input().split(' ')]
r = filter(lambda x: x + k <= 5, remains)
print(len([i for i in r]) // 3)


import sys

def data():
	return sys.stdin.readline().strip()

def sp():
	return map(int, data().split())

def l():
	return list(sp())
temp = l()
n = temp[0]
k = temp[1]
times = l()
allowed = []
for i in range(5 - k + 1):
	allowed.append(i)
res = []
for j in times:
	if j in allowed:
		res.append(j)
print(len(res) // 3)


anslist = []
x = [int(item) for item in input().split()]
y = [int(item) for item in input().split()]
k = x[1]
n = x[0]
for item in y:
	if item <= 5 - k:
		anslist.append(item)
print(int(len(anslist) / 3))


R = lambda : list(map(int, input().split()))
(n, k) = R()
a = R()
a.sort()
ans = 0
i = 0
while i <= n - 3:
	if 5 - a[i] >= k and 5 - a[i + 1] >= k and (5 - a[i + 2] >= k):
		ans += 1
	else:
		break
	i += 3
print(ans)


(n, k) = (int(x) for x in input().split())
years = [int(x) for x in input().split()]
print(sum((int(5 - k - x >= 0) for x in years)) // 3)


(n, k) = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]
z = []
for i in x:
	if i + k <= 5:
		z.append(i)
print(len(z) // 3)


import sys
from math import *
input = sys.stdin.readline
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : input().strip().split()
from collections import defaultdict as df
import heapq
infinite = float('inf')
(n, k) = RI()
l = RI()
l.sort()
c = 0
for i in range(0, n - 2, 3):
	if l[i] + k <= 5 and l[i + 1] + k <= 5 and (l[i + 2] + k <= 5):
		c += 1
print(c)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
b = []
for i in range(len(l)):
	l[i] = l[i] + k
	if l[i] > 5:
		c = 0
	else:
		b.append(l[i])
c = []
for i in range(len(b)):
	if 5 - b[i] >= 0:
		c.append(b[i])
print(len(c) // 3)


p = list(map(int, input().split()))
n = p[0]
k = p[1]
y = sorted(list(map(int, input().split())))
i = 0
while i < len(y) and y[i] + k <= 5:
	i += 1
print(i // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
y.sort(reverse=False)
accepted_head = 0
i = 0
shift = 0
while True:
	if i + 2 >= len(y):
		break
	if y[i] + k <= 5 and y[i + 1] + k <= 5 and (y[i + 2] + k <= 5):
		accepted_head = accepted_head + 1
		i = i + 3
		continue
	i = i + 1
print(accepted_head)


(n, k) = map(int, input().split())
y = sum(map(lambda x: 5 - k >= int(x), input().split()))
print(y // 3)


l1 = input().split(' ')
n = int(l1[0])
k = int(l1[1])
l2 = input().split(' ')
l2.sort()
count = 0
for i in l2:
	temp = int(i)
	if temp + k <= 5:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
member = 0
for yi in y:
	if yi <= 5 - k:
		member += 1
print(member // 3)


(n, k) = map(int, input().split())
y = sorted(list(map(int, input().split())))
c = 0
for i in range(0, n, 3):
	if i + 1 < n and i + 2 < n:
		(p1, p2, p3) = (y[i] + k, y[i + 1] + k, y[i + 2] + k)
		if p1 <= 5 and p2 <= 5 and (p3 <= 5):
			c += 1
print(c)


(a, b) = map(int, input().split())
ls = list(map(int, input().split()))
ls.sort()
ls = [x for x in ls if x + b <= 5]
print(int(len(ls) / 3))


(n, k) = map(int, input().split())
talika = list(map(int, input().split()))
count = 0
for i in talika:
	if i < 5:
		r = 5 - i
		if r >= k:
			count += 1
print(int(count / 3))


(n, k) = input().split()
n = int(n)
k = int(k)
l = [int(x) for x in input().split()]
cnt = 0
for i in range(n):
	if l[i] + k <= 5:
		cnt = cnt + 1
if int(cnt / 3) > 0 and cnt != 0:
	print(int(cnt / 3))
else:
	print('0')


(n, k) = (input().split()[1], list(map(int, input().split())))
print(int(len(list(filter(lambda x: x + int(n) <= 5, k))) / 3))


(n, k) = map(int, input().split())
lis = [int(x) for x in input().split()]
if k > 5:
	print(0)
else:
	x = 5 - k
	count = 0
	for i in lis:
		if i <= x:
			count += 1
	print(count // 3)


(n, k) = map(int, input().split())
y = map(int, input().split())
ans = 0
for elm in y:
	if elm + k <= 5:
		ans += 1
print(ans // 3)


(n, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
a = []
count = 0
for i in l:
	if i <= 5 and 5 - i >= k:
		a.append(i)
	if len(a) == 3:
		count += 1
		a = []
print(count)


n = input().split()
x = input().split()
s = 0
for i in range(int(n[0])):
	if int(x[i]) + int(n[1]) <= 5:
		s += 1
print(s // 3)


(a, b) = (list(map(int, input().split())), list(map(int, input().split())))
b[:] = [x + a[1] for x in b]
print(sum((i < 6 for i in b)) // 3)


(a, b) = [int(i) for i in input().split()]
li = [int(i) for i in input().split()]
c = 0
for x in li:
	if 5 - x >= b:
		c += 1
print(int(c / 3))


g = input().split()
n = g[0]
k = g[1]
arr = input().split()
arr = sorted(list(arr))
ans = []
for j in range(len(arr)):
	if int(arr[j]) + int(k) <= 5:
		ans.append(arr[j])
print(len(ans) // 3)


(i, j) = map(int, input().split())
k = list(map(int, input().split()))
y = 5 - j
l = []
for a in k:
	if a <= y:
		l.append(a)
print(len(l) // 3)


a = [int(n) for n in input().split()]
s = [int(n) for n in input().split()]
k = a[1]
l = 0
for n in s:
	if n + k <= 5:
		l += 1
print(int(l / 3))


no_of_teams = 0
(m, n) = map(int, input().split())
l = list(map(int, input().split()))
for _ in l:
	if 5 - _ >= n:
		no_of_teams += 1
print(int(no_of_teams / 3))


(n, k) = map(int, input().split())
rez = list(map(int, input('').split()))
chel = 0
for i in range(len(rez)):
	if rez[i] + k <= 5:
		chel += 1
print(chel // 3)


(n, k) = map(int, input().split())
counter = 0
persons = map(int, input().split())
for h in persons:
	if h + k <= 5:
		counter += 1
print(int(counter / 3))


(n, k) = map(int, input().split())
array = list(map(int, input().split()))
c = 0
number = 0
for i in array:
	i += k
	if i <= 5:
		c += 1
number = int(c / 3)
print(number)


(n, k) = (int(x) for x in input().split())
V = [int(x) for x in input().split()]
cont = 0
for i in range(n):
	if V[i] <= 5 - k:
		cont += 1
print(cont // 3)


w = input().split()
p = input().split()
p.sort()
z = []
for i in range(0, int(w[0])):
	if int(p[i]) + int(w[1]) <= 5:
		r = p[i]
		z.append(r)
print(int(len(z) / 3))


import sys
import os
if os.environ.get('GHOST') == 'TRUE':
	sys.stdin = open('name.in')
	sys.stdout = open('name.out', 'w')

def f(x):
	return 5 - int(x)
(N, K) = map(int, input().split())
A = list(map(f, input().split()))
A.sort(reverse=True)
ans = 0
for i in range(2, N, 3):
	if A[i] >= K:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
icpc = list(map(int, input().split()))
pp = []
for i in range(n):
	if icpc[i] + k <= 5:
		pp.append(icpc[i])
print(len(pp) // 3)


(n, k) = map(int, input().split())
par = list(map(int, input().split()))
print(sum((x <= 5 - k for x in par)) // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
y.sort()
teams = int(0)
for i in range(int(0), int(len(y) / 3)):
	if y[i * 3 + 2] + k < 6:
		teams += 1
print(teams)


(n, m) = input().split()
n = int(n)
m = int(m)
l = list(map(int, input().split()))
sum = 0
for i in range(n):
	if 5 - l[i] >= m:
		sum += 1
print(sum // 3)


val = [int(n) for n in input().split()]
n = val[0]
k = val[1]
maxParticipations = 5
participations = [int(n) for n in input().split()]
numberOfParticipations = {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0}
for i in participations:
	numberOfParticipations[i] += 1
numOfParticipants = 0
for i in range(maxParticipations - k + 1):
	numOfParticipants += numberOfParticipations[i]
print(numOfParticipants // 3)


(n, k) = [int(item) for item in input().split()]
y = [int(item) for item in input().split()]
count = 0
for i in range(len(y)):
	y[i] += k
	if y[i] <= 5:
		count += 1
print(int(count / 3))


(m, n) = map(int, input().split())
a = list(map(int, input().split()))
valid = 0
for i in a:
	if i + n <= 5:
		valid += 1
print(valid // 3)


R = lambda : list(map(int, input().split()))
(n, k) = R()
Y = R()
(l, r) = (0, 5 - k)
for y in Y:
	if y <= r:
		l += 1
print(l // 3)


(x, y) = map(int, input().split())
l = list(map(int, input().split()))
l1 = sorted(l)
d = 0
for i in range(0, len(l1)):
	if (i + 1) % 3 == 0:
		if l1[i] + y <= 5:
			d += 1
print(d)


__author__ = 'Lipen'

def main():
	(n, k) = map(int, input().split())
	ydata = sorted(list(map(int, input().split())))
	ans = 0
	for i in range(n // 3):
		d = ydata[i * 3:(i + 1) * 3]
		if d[0] <= 5 - k and d[1] <= 5 - k and (d[2] <= 5 - k):
			ans += 1
		else:
			break
	print(ans)
main()


(_, x) = map(int, input().split())
arr = list(map(int, input().split()))
p = 0
for i in arr:
	if 5 - i >= x:
		p += 1
print(p // 3)


import math
import itertools
gh = lambda : map(int, input().split())
mod = 998244353
mod = int(mod)

def can(m, s):
	return 9 * m >= s and s >= 0

def main():
	(n, k) = gh()
	a = sorted(list(gh()))
	cnt = 0
	for i in range(0, n // 3 * 3, 3):
		fl = True
		for j in range(i, i + 3):
			fl = 5 - a[j] >= k
		cnt += fl
	print(cnt)
main()


def single_integer():
	return int(input())

def multi_integer():
	return map(int, input().split())

def string():
	return input()

def multi_string():
	return input().split()
(n, k) = multi_integer()
shows = multi_integer()
ans = 0
for i in shows:
	if i + k <= 5:
		ans += 1
print(ans // 3)


(n, k) = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
sumsum = 0
for i in range(6 - k):
	sumsum += y.count(i)
print(sumsum // 3)


(n, k) = map(int, input().split())
t = [int(t) for t in input().split()]
m = 0
for i in t:
	if k <= 5 - i:
		m += 1
print(m // 3)


(n, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
l = sorted(l)
l = [x + k for x in l]
c = 0
x = 0
while x < n - 2:
	if l[x + 2] <= 5:
		c += 1
		x += 3
	else:
		break
print(c)


import math
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
l1 = []
for i in l:
	if i <= 5 - k:
		l1.append(i)
z = len(l1)
if z % 3 == 0:
	print(z // 3)
else:
	z = z / 3
	print(math.floor(z))


(n, k) = map(int, input().split())
people = [int(pep) for pep in input().split(' ', n - 1)]
team = 0
count = 0
for i in people:
	if i + k <= 5:
		team += 1
		if team == 3:
			count += 1
			team = 0
print(count)


a = list(map(int, input().split()))
k = a[1]
l = list(map(int, input().split()))
count = 0
for i in l:
	if i + k <= 5:
		count += 1
print(count // 3)


string = input().split()
n = int(string[0])
k = int(string[1])
count = 0
string_y = list(map(int, input().split()))
for i in string_y:
	res = i + k
	if res <= 5:
		count += 1
print(count // 3)


(a, b) = list(map(int, input().split()))
c = list(map(int, input().split()))
c.sort()
last = 2
team = 0
for i in range(a // 3):
	if c[last] + b <= 5:
		last += 3
		team += 1
	else:
		break
print(team)


from sys import stdin as cin
from math import factorial as f
(n, k) = map(int, cin.readline().split())
a = list(map(int, cin.readline().split()))
a.sort()
count = 0
tmp = 0
for x in a:
	if 5 - x - k >= 0:
		tmp += 1
		flag = 1
	else:
		flag = 0
	if tmp % 3 == 0 and flag == 1:
		tmp = 0
		count += 1
print(count)


(n, k) = [int(i) for i in input().split()]
s = [int(i) for i in input().split()]
c = 0
for i in range(len(s)):
	if 5 - s[i] >= k:
		c = c + 1
print(c // 3)


(n, k) = map(int, input().split())
count = 0
A = list(map(int, input().split()))
for i in range(len(A)):
	if 5 - A[i] >= k:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
per = [5 - int(x) for x in input().split()]
print(sum((x >= k for x in per)) // 3)


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
d = 5 - b
p = []
for i in l:
	if i <= d:
		p.append(i)
print(len(p) // 3)


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
k = 5 - b
r = []
for i in range(k + 1):
	r.append(l.count(i))
print(sum(r) // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
a = [i for i in y if i + k <= 5]
print(len(a) // 3)


(a, b) = map(int, input().split())
k = list(map(lambda x: int(x) + b, input().split()))
p = list(filter(lambda x: x <= 5, k))
print(len(p) // 3)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
people = 0
for el in a:
	if el + k <= 5:
		people += 1
print(people // 3)


(n, k) = map(int, input().split(' '))
programmers = input().split(' ')
younglings = []
for proger in programmers:
	if 5 - k >= int(proger):
		younglings.append(int(proger))
print(len(younglings) // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
k = [5 - l[i] - k for i in range(n)]
h = list(filter(lambda x: x >= 0, k))
if len(h) >= 3:
	print(len(h) // 3)
else:
	print(0)


(n, k) = map(int, input().split())
y = [int(i) for i in input().split()]
copy = y[:]
for i in copy:
	if i + k - 1 >= 5:
		y.remove(i)
print(len(y) // 3)


(n, k) = map(int, input().split())
l = sorted(list(map(int, input().split())))
for i in range(n):
	l[i] += k
teams = 0
i = 0
while i < n - 2:
	if l[i] <= 5 and l[i + 1] <= 5 and (l[i + 2] <= 5):
		teams += 1
		i += 3
	else:
		i += 1
print(teams)


row = input().split()
n = int(row[0])
k = int(row[1])
part = list((int(x) for x in input().split() if int(x) + k < 6))
print(int(len(part) / 3))


(n, k) = map(int, input().split())
list1 = list(map(int, input().split()))
mem = 0
for x in range(n):
	if list1[x] <= 5 - k:
		mem += 1
print(int(mem / 3))


list1 = [int(i) for i in input().split(' ')]
n = list1[0]
k = list1[1]
list2 = [int(i) for i in input().split(' ')]
count = 0
for i in list2:
	if i <= 5 - k:
		count += 1
print(int(count / 3))


(n, k) = map(int, input().split())
lis = [int(i) for i in input().split()]
num = 0
for j in lis:
	if j <= 5 - k:
		num += 1
print(num // 3)


n = int(input().split()[1])
team = 0
for x in map(int, input().split()):
	if x + n < 6:
		team += 1
print(team // 3)


import math
(n, k) = input().split()
n = int(n)
k = int(k)
p = input().split()
p = [int(x) for x in p]
finalp = [x for x in p if x + k <= 5]
print(math.floor(len(finalp) / 3))


(n, k) = [int(x) for x in input().split()]
vals = [int(x) for x in input().split()]
ctr = 0
for val in vals:
	if val <= 5 - k:
		ctr += 1
print(str(int(ctr / 3)))


from sys import stdin, stdout
from bisect import bisect_left, bisect_right
(n, k) = map(int, stdin.readline().split())
A = list(map(int, stdin.readline().split()))
A.sort()
if n < 3:
	print(0)
else:
	teams = 0
	i = 2
	while i < n:
		if 5 - A[i] >= k:
			teams = teams + 1
			i = i + 3
		else:
			break
	print(teams)


S = input().split()
n = int(S[0])
p = int(S[1])
k = 0
l = list(map(int, input().split()))
for x in l:
	if x + p <= 5:
		k = k + 1
print(k // 3)


import os
import sys
from io import BytesIO, IOBase
import math as M
import itertools as ITR
from collections import defaultdict as D
from collections import Counter as C
from collections import deque as Q
import threading
from functools import lru_cache, reduce
from functools import cmp_to_key as CMP
from bisect import bisect_left as BL
from bisect import bisect_right as BR
import random as R
import string
import cmath, time
enum = enumerate
start_time = time.time()
MOD = 1000000007
MA = float('inf')
MI = float('-inf')
di8 = ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1))
di4 = ((1, 0), (0, 1), (-1, 0), (0, -1))

def increase_stack():
	sys.setrecursionlimit(2 ** 32 // 2 - 1)
	threading.stack_size(1 << 27)

def binary(n):
	return bin(n)[2:]

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def maxfactor(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
	if q:
		return q[-1]

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	l.sort()
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def seive(n):
	a = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p = p + 1
	for p in range(2, n + 1):
		if prime[p]:
			a.append(p)
	prime[0] = prime[1] = False
	return (a, prime)

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countchar(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def str_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def lis(arr):
	n = len(arr)
	lis = [1] * n
	maximum = 0
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
				maximum = max(maximum, lis[i])
	return maximum

def lcm(arr):
	a = arr[0]
	val = arr[0]
	for i in range(1, len(arr)):
		gcd = gcd(a, arr[i])
		a = arr[i]
		val *= arr[i]
	return val // gcd

def ncr(n, r):
	return M.factorial(n) // (M.factorial(n - r) * M.factorial(r))

def npr(n, r):
	return M.factorial(n) // M.factorial(n - r)

def IF(c, t, f):
	return t if c else f

def YES(c):
	print(IF(c, 'YES', 'NO'))

def Yes(c):
	print(IF(c, 'Yes', 'No'))

def yes(c):
	print(IF(c, 'yes', 'no'))

def JA(a, sep=' '):
	print(sep.join(map(str, a)))

def JAA(a, s='\n', t=' '):
	return s.join((t.join(map(str, b)) for b in a))

def PS(a, s=' '):
	print(str(a), end=s)

def I():
	return int(inp())

def F():
	return float(inp())

def LI():
	return list(map(int, inp().split()))

def LF():
	return list(map(float, inp().split()))

def MATI(n):
	return [LI() for i in range(n)]

def MATS(n):
	return [list(inp()) for i in range(n)]

def IV():
	return map(int, inp().split())

def FV():
	return map(float, inp().split())

def LS():
	return list(inp())

def S():
	return inp()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
inp = lambda : sys.stdin.readline().rstrip('\r\n')
TestCases = 0

def solve():
	(n, k) = IV()
	arr = LI()
	dic = D(int)
	for i in arr:
		dic[i] += 1
	tot = 0
	want = 5 - k + 1
	for i in range(want):
		tot += dic[i]
	print(tot // 3)

def main():
	flag = 1
	try:
		sys.stdin = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/input.txt', 'r')
		sys.stdout = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/output.txt', 'w')
	except:
		flag = 0
	t = 1
	if TestCases:
		t = I()
	for _ in range(1, t + 1):
		solve()
	if flag:
		print('Time: %.4f sec' % (time.time() - start_time))
		localtime = time.asctime(time.localtime(time.time()))
		print(localtime)
		sys.stdout.close()
main()


from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	(n, k) = map(int, input().split())
	a = ain()
	a.sort()
	count = 0
	i = 0
	while i < n - 2:
		if a[i + 2] <= 5 - k:
			count += 1
			i += 2
		i += 1
	print(count)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


inp = list(map(int, input().split()))
(n, k) = (inp[0], inp[1])
y = list(map(int, input().split()))
var = 5 - k
count = 0
for x in y:
	if x <= var:
		count += 1
print(count // 3)


import math
n = input()
k = n.split()
for i in range(2):
	k[i] = int(k[i])
n = input()
j = n.split()
for i in range(k[0]):
	j[i] = int(j[i])
n = k[0]
k = k[1]
l = []
for i in range(n):
	if 5 - j[i] >= k:
		l.append(i)
print(math.floor(len(l) / 3))


(x, y) = input().split()
arr = input()
l = list(map(int, arr.split(' ')))
l.sort()
a = 0
c = 0
for c in range(int(x)):
	if 5 - l[c] >= int(y):
		a += 1
	c += 1
print(a // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ideal = 5 - k
count = 0
for i in l:
	if i <= ideal:
		count += 1
teams = count // 3
print(teams)


n = lambda : map(int, input().split())
(_, m) = n()
print(sum((a <= 5 - m for a in n())) // 3)


(x, y) = list(map(int, input().split()))
nums = list(map(int, input().split()))
c = 0
for i in nums:
	if 5 - i >= y:
		c += 1
print(c // 3)


(n, k) = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
count = len([i for i in y if i + k <= 5])
print(count // 3)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))

def removeall_replace(element, lst):
	t = [y for y in lst if y != element]
	del lst[:]
	lst.extend(t)
(n, k) = get_int_list()
scores = get_int_list()
count = 0
for i in range(n):
	if scores[i] + k <= 5:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
list_participants = list(map(int, input().split()))
number_eligible = 0
for i in range(n):
	if list_participants[i] <= 5 - k:
		number_eligible += 1
print(int(number_eligible / 3))


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
cnt = 0
for i in range(a):
	if 5 - l[i] >= b:
		cnt += 1
print(cnt // 3)


(n, k) = map(int, input().split())
print(len([i for i in sorted(list(map(int, input().split()))) if i + k <= 5]) // 3)


inp = input().split()
inp1 = input().split()
l = []
for x in range(int(inp[0])):
	if abs(int(inp[1]) + int(inp1[x])) <= 5:
		l.append(x)
print(int(len(l) / 3))


(n, k) = [int(i) for i in input().split(' ')]
sequence = [int(i) for i in input().split(' ')]
result = 0
if n >= 3:
	for i in range(6 - k):
		result += sequence.count(i)
print(result // 3)


counter = 0
(students, years) = [int(i) for i in input().split()]
usage = [int(i) for i in input().split()]
for i in range(len(usage)):
	if usage[i] <= 5 - years:
		counter += 1
print(int(counter / 3))


from bisect import bisect
(n, k) = map(int, input().split())
ls = list(map(int, input().split()))
ls.sort()
ans = bisect(ls, 5 - k)
print(ans // 3)


(n, k) = list(map(int, input().split()))
yi = list(map(int, input().split()))
num_peo = 0
for peo in yi:
	if peo <= 5 - k:
		num_peo += 1
print(num_peo // 3)


(n, k) = map(int, input().split())
s = [int(x) for x in input().split()]
q = []
for i in range(6):
	q.append(s.count(i))
total = sum(q[:5 - k + 1])
print(total // 3)


class Solution:

	def __init__(self):
		(self.n, self.k) = map(int, input().split())
		self.f = list(map(int, input().split()))
		self.cnt = 0

	def solution(self):
		for i in self.f:
			if 5 - i >= self.k:
				self.cnt += 1
		print(self.cnt // 3)

def main():
	ob = Solution()
	ob.solution()
main()


def main():
	(n, k) = map(int, input().strip().split())
	times = list(map(int, input().strip().split()))
	times.sort()
	count = 0
	k = 5 - k
	for index in range(0, n, 3):
		if not index + 2 >= n:
			if times[index] <= times[index + 1] <= times[index + 2] <= k:
				count += 1
	print(count)
main()


(n, k) = map(int, input().split())
contestants = [int(c) for c in input().split()]
aux = 0
t = 0
for c in contestants:
	if c + k <= 5:
		aux += 1
	if aux == 3:
		t += 1
		aux = 0
print(t)


a = list(map(int, input().split()))
a[1] = 5 - a[1]
(b, c) = (list(map(int, input().split())), 0)
for i in b:
	if not i > a[1]:
		c += 1
print(c // 3)


ch = input()
fh = ch.split(' ')
sh = input()
n = int(fh[0])
k = int(fh[-1])
f = sh.split(' ')
l = [int(i) for i in f]
l.sort()
s = n // 3
for i in range(s):
	mn = [l[j] for j in range(i * 3, (i + 1) * 3)]
	for p in mn:
		if p > 5 - k:
			s -= 1
			break
print(s)


(n, k) = [int(x) for x in input('').split()]
list = [int(x) for x in input('').split()]
clist = []
del list[n:]
count = 0
if k > 5:
	print(0)
	exit()
for x in list:
	if 5 - x >= k:
		clist.append(1)
		count += 1
	else:
		clist.append(0)
print(int(count / 3))


def fun(n, k, li):
	li = [k + i for i in li if k + i <= 5]
	print(len(li) // 3)
(n, k) = list(map(lambda x: int(x), input().split()))
li = list(map(lambda x: int(x), input().split()))
fun(n, k, li)


(n, k) = map(int, input().split())
p_list = list(map(int, input().split()))
m_tot = 0
for _ in p_list:
	if 5 - _ >= k:
		m_tot += 1
print(m_tot // 3)


(n, m) = map(int, input().split())
ar = list(map(int, input().split()))
ar = [int(i) + m for i in ar if int(i) + m <= 5]
print(len(ar) // 3)


z = list(map(int, input().split()))
y = list(map(int, input().split()))
q = []
l = []
u = []
h = []
k = []
x = []
n = []
c = 0
if z[1] <= 5:
	if len(y) != z[0]:
		print('is wrong')
	else:
		for i in y:
			if i < 5:
				q.append(5 - i)
	for r in q:
		if z[1] == 5 and r == 5:
			l.append(r)
		if z[1] == 4 and r >= 4:
			u.append(r)
		if z[1] == 3 and r >= 3:
			h.append(r)
		if z[1] == 2 and r >= 2:
			k.append(r)
		if z[1] == 1:
			n.append(r)
if len(k) >= 3:
	print(int(len(k) / 3))
elif len(l) >= 3 and len(l):
	print(int(len(l) / 3))
elif len(u) >= 3:
	print(int(len(u) / 3))
elif len(h) >= 3:
	print(int(len(h) / 3))
elif len(n) >= 3:
	print(int(len(n) / 3))
else:
	print(0)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
dis = 5 - k + 1
eligible = 0
for i in range(n):
	if y[i] < dis:
		eligible += 1
print(eligible // 3)


import sys
import math
from random import randint
(n, k) = map(int, input().split())
y = list(map(int, input().split()))
ans = 0
for i in range(n):
	if k + y[i] <= 5:
		ans += 1
print(ans // 3)


(n, k) = map(int, input().split())
l = input().split()
count = 0
for i in l:
	if not int(i) > 5 - k:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
good = []
tab = list(map(int, input().split()))
for i in tab:
	if i <= 5 - k:
		good.append(i)
print(len(good) // 3)


(n, k) = input().split()
(n, k) = (int(n), int(k))
yi = [int(i) for i in input().split()]
yi = sorted(yi)
s = 0
patry = 0
for i in range(n):
	if yi[i] + k <= 5:
		s += 1
	if s == 3:
		s = 0
		patry += 1
print(patry)


(n, k) = map(int, input().split())
string = input().split()
count = 0
for i in string:
	temp = int(i)
	if k + temp > 5:
		continue
	else:
		count += 1
print(count // 3)


[n, k] = [int(x) for x in input().split(' ')]
y = [int(x) for x in input().split(' ')]
people = sum((1 for x in y if x + k <= 5))
print(people // 3)


(n, k) = map(int, input().split())
ls = list(map(int, input().split()))
arr = []
for i in range(n):
	op = ls[i]
	op += k
	if op <= 5:
		arr.append(ls[i])
if len(arr) < 3:
	print(0)
else:
	print(len(arr) // 3)


def choosing_teams(n, k, y):
	y = sorted(y)
	teams = 0
	for i in range(0, n, 3):
		if i + 1 < n and i + 2 < n:
			ply1 = y[i] + k
			ply2 = y[i + 1] + k
			ply3 = y[i + 2] + k
			if ply1 <= 5 and ply2 <= 5 and (ply3 <= 5):
				teams += 1
	return teams
(n, k) = map(int, input().split())
y = list(map(int, input().split()))
print(choosing_teams(n, k, y))


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
va = 0
for a in A:
	if 5 - a >= k:
		va += 1
print(va // 3)


(n, k) = map(int, input().split())
ai = list(map(int, input().split()))
cnt = 0
for i in ai:
	if 5 - i >= k:
		cnt += 1
print(cnt // 3)


(n, k) = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
if len(x) < 3:
	print(0)
	exit()
elif len(x) < 6:
	for i in x[0:3]:
		if i + k > 5:
			print(0)
			exit()
	print(1)
	exit()
else:
	sum1 = 0
	f = 0
	f1 = f + 3
	check = False
	while f1 <= len(x):
		then = x[0:len(x) - len(x) % 3]
		now = then[f:f1]
		for i in now:
			if i + k > 5:
				check = False
				break
			else:
				check = True
		if check == True:
			sum1 += 1
		f += 3
		f1 = f + 3
print(sum1)


def main():
	[n, k] = [int(_) for _ in input().split()]
	times = [int(_) for _ in input().split()]
	max_participations = 5 - k
	count = sum((x <= max_participations for x in times))
	print(count // 3)
main()


def printTeams(n, k, arr):
	count = 0
	for i in range(0, k):
		for j in range(0, len(arr)):
			arr[j] = arr[j] + 1
	for j in range(0, len(arr)):
		if arr[j] <= 5:
			count += 1
	return int(count / 3)
arr = input().split(' ')
numPersons = int(arr[0])
nTimes = int(arr[1])
arrTimes = [int(i) for i in input().split(' ')]
print(printTeams(numPersons, nTimes, arrTimes))


(n, k) = [int(i) for i in input().split()]
y = sorted([int(i) + k for i in input().split()])
a = list(filter(lambda x: x <= 5, y))
print(len(a) // 3)


(x, y) = map(int, input().split())
ar = list(map(int, input().split()))
ar.sort()
for i in range(len(ar)):
	ar[i] = ar[i] + y
count = 0
for i in ar:
	if i <= 5:
		count = count + 1
print(int(count / 3))


(n, k) = map(int, input().split())
ls = list(map(int, input().split()))
ans = 0
for i in ls:
	if i + k < 6:
		ans += 1
print(ans // 3)


(n, k) = input().split()
(n, k) = (int(n), int(k))
l = [int(x) for x in input().split()]
l.sort()
nr = 0
for x in l:
	if x + k <= 5:
		nr += 1
	else:
		break
print(nr // 3)


a = input().split()
k = int(a[1])
b = [5 - int(i) for i in input().split() if 5 - int(i) >= k]
print(len(b) // 3)


def s(m):
	return [i for i in [m[i:i + 3] for i in range(0, len(m), 3)] if len(i) == 3]
(n, k) = map(int, input().split())
print(len([i for i in [i for i in s(sorted(list(map(int, input().split())))) if len(i) <= 3] if max(i) + k <= 5]))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
poss = 0
for i in l:
	if i + k <= 5:
		poss += 1
if poss < 3:
	print(0)
else:
	print(poss // 3)


nk = list(map(int, input().split()))
team = list(map(int, input().split()))
team_counter = 0
members = 0
for i in range(nk[0]):
	if team[i] + nk[1] <= 5:
		members += 1
		team[i] = 5
	if members == 3:
		team_counter += 1
		members = 0
print(team_counter)


def chunk(arr, size):
	_newContent = []
	while len(arr) > 0:
		_newContent.append(arr[0:size])
		arr = arr[size:]
	return _newContent
(n, k) = map(int, input().split())
l = sorted(list(map(int, input().split())))
ex = n % 3
if ex:
	while ex:
		l.pop()
		ex -= 1
l = chunk(l, 3)
res = 0
for i in l:
	if len(i) == 3:
		i[:] = [x + k for x in i]
		z = 0
		for r in i:
			if r <= 5:
				z += 1
		res += 1 if z == 3 else False
print(res)


line = input()
T = int(line.split(' ')[0])
N = int(line.split(' ')[1])
line = input()
somme = 0
for i in range(T):
	a = int(line.split(' ')[i])
	if N + a <= 5:
		somme += 1
print(somme // 3)


(n, k) = map(int, input().split())
kom = list(map(int, input().split()))
participate = []
for i in kom:
	if i + k <= 5:
		participate.append(i)
print(len(participate) // 3)


(n, k) = map(int, input().split())
array = list(map(int, input().split()))
array.sort()
c = 0
c1 = 0
for i in array:
	if i + k <= 5:
		c += 1
	else:
		break
	if c == 3:
		c1 += 1
		c = 0
print(c1)


(n, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
dl = dict()
count = 0
for i in range(n):
	dl[i] = l[i]
x = sorted(dl, key=lambda k: dl[k])
for i in range(0, n - n % 3, 3):
	team = x[i:i + 3]
	team = [l[j] for j in team]
	if max(team) + k <= 5:
		count += 1
print(count)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
k1 = []
for i in range(n):
	if l[i] <= 5 - k:
		k1.append(l[i])
print(len(k1) // 3)


(a, k) = [int(x) for x in input().split()]
x = [int(x) for x in input().split()]
ans = 0
for item in x:
	if 5 - item >= k:
		ans += 1
print(int(ans // 3))


arr = [int(x) for x in input().split()]
n = arr[0]
k = arr[1]
arr = [int(x) for x in input().split()]
count = 0
for val in arr:
	if val < 5 and val + k <= 5:
		count += 1
print(count // 3)


def P0127_team_choosing(a, x):
	b = [int(i) for i in x if int(i) <= 5 - a]
	return len(b) // 3
a = int(input().split()[1])
x = input().split()
result = P0127_team_choosing(a, x)
print(result)


(n, k) = map(int, input().split())
print(len([i for i in map(int, input().split()) if i + k < 6]) // 3)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
count = 0
for i in arr:
	if i + k < 6:
		count += 1
print(count // 3)


import math
inp = input().split()
n = int(inp[0])
m = int(inp[1])
arr = input().split()
c = 0
for ch in arr:
	if int(ch) + m <= 5:
		c += 1
print(str(math.floor(c / 3)))


(n, t) = input().split(' ')
n = int(n)
t = int(t)
p = 5 - t
s = list(map(int, input().split(' ')))
m = 0
j = 0
for i in range(n):
	if s[i] <= p:
		m = m + 1
		if m == 3:
			j = j + 1
			m = 0
print(j)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
c = []
s = 0
for i in y:
	if k + i <= 5:
		c.append(i)
		if len(c) % 3 == 0:
			s += 1
print(s)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
l = [int(i) for i in input().split(' ')]
check = []
for i in sorted(l):
	if i + k <= 5:
		check.append(i)
print(len(check) // 3)


(n, k) = map(int, input().split())
lis = list(map(int, input().split()))
lisB = list(filter(lambda x: 5 - x >= k, lis))
print(len(lisB) // 3)


(n, m) = map(int, input().split())
li = list(map(int, input().split()))
x = 0
for i in li:
	if 5 - i >= m:
		x += 1
print(int(x / 3))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l)
(i, cnt) = (0, 0)
while i < n - 2:
	team = l[i:i + 3]
	if 5 - max(team) >= k:
		cnt += 1
	i += 3
print(cnt)


ss = input()
ar = ss.split(' ')
n = int(ar[0])
k = int(ar[1])
ans = int(0)
s = input()
arr = s.split(' ')
for x in range(n):
	a = int(arr[x])
	if a <= int(5 - k):
		ans = int(ans) + 1
print(int(ans / 3))


import sys
import math as m

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def sinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def ninp():
	return map(int, sys.stdin.readline().strip().split())

def linp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(a):
	print(a)
(n, k) = [int(x) for x in input().split()]
y = list(map(int, input().split()))
cnt = 0
for i in y:
	if 5 - i >= k:
		cnt += 1
print(cnt // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
t = 0
for i in range(n):
	if l[i] > 5 - k:
		l[i] = 6
		t += 1
while t > 0:
	l.remove(6)
	t -= 1
print(len(l) // 3)


from sys import stdin, stdout
nk = list(map(int, stdin.readline().strip().split()))
n = nk[0]
k = nk[1]
match_num = list(map(int, stdin.readline().split()))
count = 0
for i in range(n):
	if match_num[i] <= 5 - k:
		count += 1
stdout.write(str(count // 3))


(n, k) = map(int, input().split())
players = list(map(int, input().split()))
eligible = 0
for p in players:
	if p + k <= 5:
		eligible += 1
	else:
		continue
x = eligible // 3
if x > 0:
	print(x)
else:
	print(0)


inp = []
for i in range(2):
	inp.append(input().split(' '))
n = int(inp[0][0])
k = int(inp[0][1])
if n in range(0, 2001) and k in range(0, 6):
	if len(inp[0]) > 2 or len(inp[1]) > n:
		print('Invalid Input')
	else:
		limit = 5 - k
		member_count = 0
		team_count = 0
		inp[1].sort()
		for i in inp[1]:
			if int(i) <= limit:
				member_count += 1
			else:
				break
			if member_count == 3:
				team_count += 1
				member_count = 0
		print(team_count)
else:
	print('Invalid Range. Must be:\n1 <= n <=2000\n1 <= k <= 5')


from collections import Counter
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for i in range(n):
	if 5 - a[i] >= k:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
participants = sorted([int(x) for x in input().split() if int(x) <= 5 - k])
a = len(participants) // 3
print(a)


(n, k) = map(int, input().split())
s = [int(x) for x in input().split()]
s.sort()
a = 0
for i in s:
	if i + k > 5:
		break
	a = a + 1
print(a // 3)


(n, k) = input().split()
n = int(n)
k = int(k)
y = list(map(int, input().split()))
teams = 0
members = 0
for user in y:
	if user + k <= 5:
		members += 1
		if members == 3:
			teams += 1
			members = 0
print(teams)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
ans = 0
c = 5 - k
for i in map(int, input().split()):
	if i <= c:
		ans += 1
print(ans // 3)


(n, k) = list(map(int, input().split()))
l = list(map(lambda x: int(x) + k, input().split()))
l.sort()
ans = 0
c = 0
for i in range(n):
	if l[i] > 5:
		break
	if (i + 1) % 3 == 0:
		ans += 1
print(ans)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [5 - i for i in a]
c = [i - k for i in b]
m = 0
for i in c:
	if i >= 0:
		m += 1
print(m // 3)


(n, k) = input().split()
n = int(n)
k = int(k)
x = input().split()
x = [int(i) for i in x]
x = [int(5 - i) for i in x]
a = sum((i >= k for i in x))
print(int(a / 3))


import math
(n, k) = map(int, input().split())
print(math.floor(len(list(filter(lambda i: i + k <= 5, map(int, input().split())))) / 3))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
li = []
count = 0
for i in l:
	if 5 - i >= k:
		count += 1
	li.append(5 - i)
print(count // 3)


import math
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
x = []
for i in range(n):
	if l[i] <= 5 - k:
		x.append(l[i])
print(math.floor(len(x) / 3))


(n, k) = list(map(int, input().rstrip().split()))
std = list(map(int, input().rstrip().split()))
valid = []
for i in std:
	if 5 - i >= k:
		valid.append(i)
print(len(valid) // 3)


(n, k) = map(int, input().split(' '))
list1 = sorted(list(map(int, input().split(' '))))
count = 0
for i in range(0, n, 3):
	try:
		l = list(list1[i:i + 3])
		if 5 - max(l) >= k and len(l) == 3:
			count += 1
	except IndexError:
		break
print(count)


import math
(n, k) = map(int, input().split())
lst = list((int(num) for num in input().split()))[:n]
possible = 0
lst1 = []
for ele in lst:
	if ele <= 5 - k:
		possible += 1
		lst1.append(ele)
if possible < 3:
	print('0')
else:
	x = math.floor(len(lst1) / 3)
	print(x)


(n, k) = [int(i) for i in input().split()]
ans = 0
team = 0
student = 0
for i in input().split():
	student = int(i)
	if student + k <= 5:
		team += 1
	if team == 3:
		team = 0
		ans += 1
print(ans)


def main():
	(n, k) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	a.sort()
	sum = 0
	for i in a:
		if i <= 5 - k or i == 0:
			sum += 1
	print(sum // 3)
main()


(n, k) = [int(i) for i in input().split()]
members = sorted([int(i) for i in input().split()])
amount = 0
groups = 0
for i in members:
	if 5 - i >= k:
		amount += 1
	if amount == 3:
		groups += 1
		amount = 0
print(groups)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string
import io

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def lrfind(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ceil(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lw():
	return input().split()

def lcm(a, b):
	return abs(a * b) // gcd(a, b)

def prr(a, sep=' ', end='\n'):
	print(sep.join(map(str, a)), end=end)

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
(n, k) = mi()
a = li()
count = 0
for i in a:
	if i <= 5 - k:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
x = []
for i in y:
	if i + k <= 5:
		x.append(i)
print(len(x) // 3)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
team = 0
for i in a:
	if i + k <= 5:
		team += 1
	else:
		continue
print(int(team / 3))


(n, a) = map(int, input().split())
N = [int(num) for num in input().split(' ', n - 1)]
X = i = 0
while i < n:
	if N[i] + a <= 5:
		X += 1
	i += 1
print(X // 3)


l = input()
(n, k) = l.split()
yn = input()
nof = yn.split()
n = int(n)
k = int(k)
count = 0
for i in range(n):
	if eval(nof[i]) + k <= 5:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
print(sum((1 for x in input().split() if int(x) + k <= 5)) // 3)


ar = []
for i in input().split(' '):
	ar.append(int(i))
temp = 5 - ar[1]
count = 0
for i in input().split(' '):
	val = int(i)
	if val <= temp:
		count = count + 1
print(count // 3)


f = lambda : map(int, input().split())
(n, k) = f()
c = 0
t = list(f())
t.sort()
for i in range(len(t)):
	t[i] += k
for i in range(3, len(t) + 1, 3):
	c += all((i <= 5 for i in t[i - 3:i]))
print(c)


(n, k) = [int(x) for x in input().split()]
t = [int(y) for y in input().split()]
l = []
for i in range(n):
	if t[i] + k <= 5:
		l.append(t[i])
print(len(l) // 3)


from sys import stdin

def main():
	(n, k) = map(int, stdin.readline().strip().split())
	k = 6 - k
	return sum(map(lambda s: int(s) < k, stdin.readline().strip().split())) // 3
print(main())


a = list(map(int, input().split()))
b = list(map(int, input().split()))
b.sort()
count = 0
index = 0
while True:
	if index == a[0] or a[0] - index < 3:
		break
	if b[index] + a[1] <= 5 and b[index + 1] + a[1] <= 5 and (b[index + 2] + a[1] <= 5):
		count += 1
		index += 3
	else:
		break
print(count)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
print(len([x for x in s if x + k <= 5]) // 3)


nkStr = input()
n = int(nkStr.split()[0])
k = int(nkStr.split()[1])
yStr = input()
yList = yStr.split()
y = [0] * n
usableMAN = 0
for i in range(n):
	y[i] = int(yList[i])
	if y[i] <= 5 - k:
		usableMAN = usableMAN + 1
print(usableMAN // 3)


(members, to_win) = list(map(int, input().split()))
past = list(map(int, input().split()))
ok = 0
for i in range(members):
	can = 5 - past[i]
	if can >= to_win:
		ok += 1
print(ok // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
y.sort()
for i in range(n):
	y[i] += k
i = 0
while i < n and y[i] <= 5:
	i += 1
print(i // 3)


(n, k) = input().split()
n = int(n)
k = int(k)
num_of_commands = 0
num_of_champs = input().split()
for i in range(len(num_of_champs)):
	if int(num_of_champs[i]) > 5 - k:
		num_of_champs[i] = -1
	else:
		num_of_champs[i] = int(num_of_champs[i])
num_of_champs = list(filter(lambda x: x >= 0, num_of_champs))
num_of_commands += len(num_of_champs) // 3
print(num_of_commands)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr = sorted(arr)
(i, ans) = (2, 0)
while i < n:
	if arr[i] + k <= 5:
		ans += 1
	i += 3
print(ans)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
for x in range(k):
	for y in range(len(l)):
		l[y] += 1
l2 = []
l1 = []
for y in l:
	if y <= 5:
		l1.append(y)
		if len(l1) == 3:
			l2.append(l1)
			l1 = []
print(len(l2))


(n, k) = map(int, input().split())
a = sorted(list(map(lambda x: 5 - int(x), input().split())), reverse=True)
i = 2
ans = 0
while i < n and a[i] >= k:
	ans += 1
	i += 3
print(ans)


(a, b) = input().split()
(a, b) = (int(a), int(b))
m = 0
c = input().split()
for i in range(a):
	if 5 - b >= int(c[i]):
		m += 1
print(m // 3)


(a, b) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
ans = 0
k = 5 - b
for i in range(0, a):
	if arr[i] <= k:
		ans += 1
print(ans // 3)


data = input().split()
std_times = input().split()
(N, K) = (int(data[0]), int(data[1]))
std_times = list(map(int, std_times))
if all((e == 0 for e in std_times)):
	print(N // 3)
	exit
else:
	std_times = sorted(std_times)
	teams = 0
	i = 0
	while N // 3:
		if i == N - 1 or i >= N:
			break
		elif std_times[i] + K <= 5 and std_times[i + 1] + K <= 5 and (std_times[i + 2] + K <= 5):
			teams += 1
			i += 3
			continue
		else:
			i += 1
	print(teams)


(n, k) = map(int, input().split())
mas = [int(x) for x in input().split()]
mas2 = []
for i in mas:
	if i + k <= 5:
		mas2.append(i)
print(len(mas2) // 3)


b = [int(b) for b in input().split()]
c = [int(c) for c in input().split()]
d = []
n = b[0]
k = b[1]
r = 5 - k
for i in range(n):
	if c[i] <= r:
		d.append(c[i])
n = len(d)
print(n // 3)


(a, b) = [int(i) for i in input().split()]
statistics = [int(i) for i in input().split()]
team_members = 0
output = 0
for i in range(len(statistics)):
	if statistics[i] <= 5 - b:
		team_members += 1
	else:
		pass
output = team_members // 3
print(output)


(n, k) = list(map(int, input().split()))
l = [5 - x for x in list(map(int, input().split()))]
f = list(filter(lambda x: x >= k, l))
print(len(f) // 3)


a = []
a = input().split()
n = int(a[0])
k = int(a[1])
x = []
x = input().split()
for i in range(0, n):
	x[i] = int(x[i])
t = []
for i in range(0, n, 1):
	if x[i] + k < 5 or x[i] + k == 5:
		t.append(x[i])
l = len(t)
num_of_team = int(l / 3)
print(num_of_team)


def Main():
	(n, k) = map(int, input().split())
	parts = list(map(int, input().split()))
	parts.sort()
	ans = 0
	for i in range(2, n, 3):
		if parts[i] + k <= 5:
			ans += 1
	print(ans)
Main()


p = lambda : map(int, input().split())
(_, k) = p()
print(sum((x <= 5 - k for x in p())) // 3)


(n, k) = map(int, input().split())
tt = 0
for i in map(int, input().split()):
	tt += 5 - i >= k
print(tt // 3)


k = int(input().split()[1])
print(sum((x < 6 - k for x in map(int, input().split()))) // 3)


(a, b) = map(int, input().split())
li = list(map(int, input().split()))
nl = [x + b for x in li if x + b <= 5]
print(len(nl) // 3)


(n, k) = map(int, input().split())
list1 = list(map(int, input().split()))
list1.sort()
c = 0
cc = n
i = 0
if n >= 3:
	while i <= n - 3:
		if 5 - list1[i] >= k and 5 - list1[i + 1] >= k and (5 - list1[i + 2] >= k):
			c += 1
		else:
			break
		i += 3
print(c)


(n, k) = map(int, input().split())
a = [int(a) for a in input().split()]
los = []
win = []
for i in range(n):
	c = a[i] + k
	if c > 5:
		los.append(c)
	elif c <= 5:
		win.append(a[i])
for i in range(len(win)):
	if len(win) < 3:
		print(0)
		break
	print(f'{len(win) // 3}')
	break
if len(win) == 0:
	print(0)


(n, k) = input().split()
(n, k) = (int(n), int(k))
lis = input().split()
for i in range(n):
	lis[i] = int(lis[i])
c = 0
for i in range(n):
	if lis[i] <= 5 - k:
		c += 1
print(c // 3)


(n, k) = map(int, input().split())
students = input().split()
eligible = 0
for i in range(n):
	students[i] = int(students[i])
	if students[i] + k <= 5:
		eligible += 1
print(eligible // 3)


(ludi, rokov) = map(int, input().split())
ludia = list(sorted(map(int, input().split())))
(tymov, tym) = (0, 0)
for clovek in ludia:
	if 5 - clovek >= rokov:
		if tym == 2:
			tymov += 1
		tym = (tym + 1) % 3
print(tymov)


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	(n, k) = map(int, input().split(' '))
	print(len(list(filter(lambda x: x >= k, list(map(lambda x: 5 - int(x), input().split(' ')))))) // 3)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l = list(filter(lambda x: x + m <= 5, l))
print(len(l) // 3)


import sys
(n, k) = [int(x) for x in sys.stdin.readline().split()]
y = [int(x) for x in sys.stdin.readline().split()]
y.sort(reverse=True)
z = 5 - k
x = 0
for i in range(n):
	if z >= y[i]:
		x = i + 1
		break
if x == 0:
	print(0)
else:
	print(int((n - x + 1) / 3))


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
c = 0
for v in m:
	if v <= 5 - k:
		c += 1
print(c // 3)


(n, k) = input().split()
n = int(n)
k = int(k)
counter = 0
list1 = [int(x) for x in input().split()]
list1.sort()
x = len(list1) % 3
for i in range(x):
	list1.pop()
main = []
list1 = [x + k for x in list1]
for i in range(0, len(list1), 3):
	if list1[i] <= 5 and list1[i + 1] <= 5 and (list1[i + 2] <= 5):
		counter += 1
print(counter)


(n, k) = list(map(int, input().split()))
ans = 0
ar = list(map(int, input().split()))
for i in range(n):
	if 5 - ar[i] >= k:
		ans += 1
if ans < 3:
	print(0)
else:
	print(int(ans / 3))


import sys

def main():
	sys_in = sys.stdin
	sys_out = sys.stdout
	(n, k) = map(int, sys_in.readline().split())
	members = list(map(int, sys_in.readline().split()))
	team = {'count': 0}
	for i in members:
		if i + k <= 5:
			team['count'] += 1
	sys_out.write(f"{team['count'] // 3}")
main()


def process(l, k):
	l.sort()
	for i in range(0, len(l)):
		l[i] += k
	counter = 0
	for i in range(0, len(l)):
		if l[i] > 5:
			counter += 1
	print((len(l) - counter) // 3)

def main():
	q = [int(x) for x in input().split()]
	p = [int(x) for x in input().split()]
	process(p, q[1])
main()


(t, n) = map(int, input().split())
l = list(map(int, input().split()))
n = 5 - n
j = 0
for i in l:
	if i <= n:
		j += 1
print(j // 3)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
select = []
z = 0
for i in arr:
	if 5 - i >= k:
		select.append(i)
x = len(select)
if x < 3:
	print(z)
else:
	print(x // 3)


(n, k) = map(int, input().split())
participations = map(int, input().split())
answer = sum((1 for p in participations if 5 - p >= k)) // 3
print(answer)


import sys
it = iter(sys.stdin.read().splitlines())
(n, k) = [int(x) for x in next(it).split()]
s = [int(x) + k for x in next(it).split()]
a = 0
for i in range(n):
	if s[i] <= 5:
		a += 1
print(int(a / 3))


(memb, gam) = map(int, input().split())
times = [int(t) for t in input().split()]
(team, cn) = (0, 0)
for i in times:
	if i + gam <= 5:
		cn += 1
	if cn == 3:
		(team, cn) = (team + 1, 0)
print(team)


(n, k) = map(int, input().split())
list1 = sorted(map(int, input().split()))
for i in range(len(list1)):
	if list1[i] + k > 5:
		n -= 1
print(n // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
req = 5 - k
cnt = 0
for i in range(n):
	if y[i] <= req:
		cnt += 1
print(cnt // 3)


(n, k) = map(int, input().split())
k = 6 - k
l = map(int, input().split())
c = 0
for i in l:
	if i < k:
		c += 1
print(c // 3)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
count = 0
for i in range(0, n // 3 * 3, 3):
	for j in range(i, i + 3):
		if arr[j] + k > 5:
			break
	else:
		count += 1
print(count)


(a, b) = map(int, input().split())
ls = list(map(int, input().split()))
p = 0
count = 0
for i in range(a):
	if ls[i] <= 5 - b:
		p += 1
	if p == 3:
		count += 1
		p = 0
print(count)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
count = 0
while k > 0:
	i = 3
	while i <= n:
		l[i - 3] += 1
		l[i - 2] += 1
		l[i - 1] += 1
		i += 3
	k -= 1
j = 3
while j <= n:
	if l[j - 3] <= 5 and l[j - 2] <= 5 and (l[j - 1] <= 5):
		count += 1
	j += 3
print(count)


(n, k) = map(int, input().split())
students = list(map(int, input().split()))
students.sort()
max_idx = -1
for i in range(n):
	if students[i] + k > 5:
		break
	max_idx = i
max_groups = (max_idx + 1) // 3 if max_idx != -1 else 0
print(max_groups)


(n, k) = input().split()
(n, k) = (int(n), int(k))
x = list(map(int, input().split()))
x[:] = (value for value in x if value < 5)
x.sort()
c = 0
for i in range(2, len(x), 3):
	if x[i] <= 5 - k:
		c += 1
print(c)


def solve(n, k, l):
	k = 5 - k
	t = 0
	for i in l:
		if i <= k:
			t += 1
	return t // 3
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = solve(n, k, l)
print(ans)


(n, k) = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
l.sort()
c = 0
for i in range(2, n, 3):
	if l[i] + k <= 5:
		c += 1
print(c)


(n, k) = [int(i) for i in input().split()]
l = list(input().split())
for i in range(n):
	l[i] = int(l[i])
l = sorted(l)
if n > 2:
	if l[2] == 5:
		print(0)
	for i in range(1000):
		a = (5 - l[2]) // k
		if a == 0:
			print(i)
			break
		else:
			l[0] = 5
			l[1] = 5
			l[2] = 5
			l = sorted(l)
else:
	print(0)


(a, b) = map(int, input().split())
c = list(map(int, input().split()))
c = [5 - i for i in c]
c = len([k for k in c if k >= b])
print(c // 3)


(participants, count_participation) = map(int, input().split())
personal_data = map(int, input().split())
count_player = 0
for player in personal_data:
	if 5 - player >= count_participation:
		count_player += 1
count_team = count_player // 3
print(count_team)


times = int(input().split(' ')[1])
students = list(map(int, input().split(' ')))
qualified_students = 0
for i in students:
	if i <= 5 - times:
		qualified_students += 1
print(qualified_students // 3)


from sys import stdin, stdout
input = stdin.readline
(n, k) = map(int, input().split())
y = list(map(int, input().split()))
ans = 0
cur = 0
for i in y:
	if 5 - i >= k:
		cur += 1
	if cur == 3:
		ans += 1
		cur = 0
stdout.write(str(ans))


k = int(input('')[-1])
s = [i for i in [int(y) for y in input('').split(' ')] if i < 6 - k]
print(len(s) // 3)


x = input().split()
n = int(x[0])
k = int(x[1])
y = input().split()
length = len(y)
counter = 0
teams = 0
while counter < length:
	if int(y[counter]) + k <= 5:
		teams += 1
	counter += 1
print(int(teams / 3))


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
m = 6 - k
a = []
for i in y:
	if i < m:
		a.append(i)
print(len(a) // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().strip().split()))
d = dict()
for i in l:
	if i + k <= 5:
		d[i] = d.get(i, 0) + 1
print(sum(d.values()) // 3)


(n, k) = map(int, input().split())
data = [int(x) for x in input().split()]
data.sort()
c = n // 3 * 3 - 1
t = n // 3
while t > 0 and 5 - data[c] < k:
	c -= 3
	t -= 1
print(t)


(n, k) = [int(x) for x in input().split()]
numbers = [int(x) for x in input().split()]
players_count = 0
for n in numbers:
	if 5 - n >= k:
		players_count += 1
print(players_count // 3)


(n, k) = map(int, input().split(' '))
List = [int(j) for j in input().split(' ')]
List.sort()
List_1 = [3 * l for l in range(0, 1 + n // 3)]
List_2 = []
count_1 = 0
for g in range(len(List_1)):
	if List_1[g] <= n - 3:
		List_2.append(List_1[g])
for i in List_2:
	count = 0
	for m in range(i, i + 3):
		if List[m] + k <= 5:
			count += 1
	if count == 3:
		count_1 += 1
print(count_1)


def solve(a, k):
	cnt = 0
	for i in range(0, len(a)):
		if 5 - a[i] >= k:
			cnt += 1
	return cnt // 3
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
print(solve(a, k))


from bisect import bisect_left
nm = input().split()
n = int(nm[0])
m = int(nm[1])
a = list(map(int, input().split()))
a.sort()
t = bisect_left(a, 5 - m + 1)
print(t // 3)


(_, k) = map(int, input().split())
print(sum((y + k <= 5 for y in map(int, input().split()))) // 3)


(n, k) = map(int, input().split())
(*l,) = map(int, input().split())
sum = 0
team = 0
for i in l:
	x = 5 - i
	if x >= k:
		sum += 1
print(sum // 3)


import math
(n, k) = map(int, input().split())
y = [int(n) for n in input().split()]
z = []
for i in y:
	if i <= 5 - k:
		z.append(i)
print(int(math.floor(len(z) / 3)))


(p, q) = input().split()
p = int(p)
q = int(q)
l = [int(x) for x in input().split()]
l.sort()
cnt = 0
for k in l:
	if 5 - k >= q:
		cnt += 1
print(int(cnt / 3))


(n, k) = input().split()
n = int(n)
k = int(k)
a = list(map(int, input().strip().split()))[:n]
a.sort()
x = 0
for i in range(0, n - 2, 3):
	if a[i] + k <= 5 and a[i + 1] + k <= 5 and (a[i + 2] + k <= 5):
		x = x + 1
		a[i] = a[i] + k
		a[i + 1] = a[i + 1] + k
		a[i + 2] = a[i + 2] + k
print(x)


(a, b) = map(int, input().split())
c = list(map(int, input().split()[:a]))
count = 0
c.sort()
kom = a // 3
for i in range(kom):
	d = c[0:3]
	if 5 - d[0] >= b and 5 - d[1] >= b and (5 - d[2] >= b):
		count += 1
	del c[0:3]
print(count)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
print(sum((1 for i in s if 5 - i >= k)) // 3)


def solve():
	(n, k) = [int(s) for s in input().split()]
	m = len([int(s) for s in input().split() if int(s) + k <= 5])
	print(m // 3)
solve()


(n, k) = [int(i) for i in input().split()]
str = [int(i) for i in input().split()]
x = 0
for i in str:
	if 5 - i >= k:
		x += 1
print(int(x / 3))


(a, k) = map(int, input().split())
l = list(map(int, input().split()))
for i in range(k):
	for j in range(len(l)):
		l[j] += 1
l2 = []
l1 = []
for j in l:
	if j <= 5:
		l1.append(j)
		if len(l1) == 3:
			l2.append(l1)
			l1 = []
print(len(l2))


(n, k) = input().split()
n = int(n)
k = int(k)
nu = input().split(' ')
c = 0
for i in nu:
	i = int(i)
	i = 5 - i
	if i >= k:
		c += 1
print(c // 3)


(n, k) = map(int, input().split())
print(len([v for v in map(int, input().split()) if 5 - v >= k]) // 3)


count = 0
(n, m) = map(int, input().split())
lis = [int(x) for x in input().split()]
for item in lis:
	if item + m <= 5:
		count += 1
print(count // 3)


def count_comands(children, k):
	children.sort()
	full_comand = 0
	bufer_comand = 0
	for child in children:
		if child + k <= 5:
			bufer_comand += 1
		if bufer_comand == 3:
			bufer_comand = 0
			full_comand += 1
	return full_comand

def main():
	(_, k) = map(int, input().split())
	children = list(map(int, input().split()))
	print(count_comands(children, k))
main()


import math
numbers = [int(x) for x in input().split(' ')]
participants = [int(x) for x in input().split(' ')]
number_of_competitions = numbers[1]
threshold = 5 - number_of_competitions
counter = 0
for i in participants:
	if i <= threshold:
		counter += 1
print(int(math.floor(counter / 3)))


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
count = [a.count(i) for i in range(6)]
ans = 0
extra = 0
for i in range(6 - k):
	ans += count[i] // 3
	extra += count[i] % 3
ans += extra // 3
print(ans)


q = input().split()
n = int(q[0])
k = int(q[1])
t = 0
a = input().split()
for x in range(n):
	if int(a[x]) <= 5 - k:
		t += 1
print(int(t / 3))


(n, k) = map(int, input().split())
a = sorted(map(int, input().split()))
x = 0
for i in range(0, len(a), 3):
	if len(a) - i >= 3:
		if max(a[i:i + 3]) + k <= 5:
			x += 1
print(x)


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
count = 0
for _ in arr:
	if _ + m <= 5:
		count += 1
print(int(count / 3))


(n, k) = map(int, input().split())
Y = list(map(int, input().split()))
l = 0
for y in Y:
	l += 1 if 5 - y >= k else 0
print(l // 3)


x = input()
x = x.split()
x1 = int(x[0])
k = int(x[1])
y = input()
y = y.split()
z = []
flag = 0
for i in range(x1):
	z.append(int(y[i]))
	if z[i] + k <= 5:
		flag += 1
		i += 1
print(int(flag / 3))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
c = 0
c1 = 5 - k
for j in range(0, len(l)):
	if l[j] <= c1:
		c = c + 1
print(c // 3)


k = list(map(int, input().split()))
s = list(map(int, input().split()))
li = []
for i in s:
	if k[1] + i < 6:
		li.append(i)
print(len(li) // 3)


(n, k) = map(int, input().split())
times = [int(x) for x in input().split()]
m = 0
for time in times:
	if 5 - time >= k:
		m += 1
print(m // 3)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
p = 0
a = sorted(a)
for i in range(0, n):
	if a[i] + k > 5:
		m = a.index(a[i])
		p = 1
		break
if p == 0:
	print(int(n / 3))
else:
	print(int(m / 3))


(n, k) = [int(x) for x in input().split(' ')]
ps = [int(x) for x in input().split(' ')]
c = 0
team_size = 3
for p in ps:
	if p + k <= 5:
		c = c + 1
print(int(c / team_size))


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
need = 5 - k
ct = 0
for i in a:
	if i <= need:
		ct += 1
print(ct // 3)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
c = []
d = []
for i in range(len(a)):
	c.append(a[i:i + 3])
for i in range(len(c)):
	if len(c[i]) == 3:
		d.append(c[i])
for i in range(len(d)):
	for j in range(3):
		d[i][j] = d[i][j] + k
q = 0
i = 0
while i < len(d):
	m = 0
	for j in range(3):
		if d[i][j] <= 5:
			m = m + 1
	if m == 3:
		q = q + 1
		i = i + 3
	else:
		i = i + 1
print(q)


n_k_line = input()
(n, k) = map(int, n_k_line.split(' '))
participants_line = input()
participants = list(map(int, participants_line.split(' ')))
possible_participants = list(filter(lambda x: k + x <= 5, participants))
print(len(possible_participants) // 3)


def read():
	return map(int, input().split())
(n, k) = read()
a = list(read())
a.sort()
i = 0
ans = 0
while i + 2 < len(a):
	if a[i] + k <= 5 and a[i + 1] + k <= 5 and (a[i + 2] + k <= 5):
		ans += 1
		i += 3
	else:
		i += 1
print(ans)


l = list(map(int, input().split()))
l2 = list(map(int, input().split()))
count = 0
for i in l2:
	if i <= 5 - l[1]:
		count += 1
print(count // 3)


def championship(team):
	count = 0
	for value in team:
		if value + number_of_champ <= 5:
			count += 1
	return count // 3
(members, number_of_champ) = map(int, input().split())
results = list(map(int, input().split()))
print(championship(results))


(_, k) = map(int, input().split())
participants = list(filter(lambda x: x < 5 and x + k <= 5, map(int, input().split())))
print(len(participants) // 3)


x = []
x = input().split()
x[0] = int(x[0])
x[1] = int(x[1])
y = []
y = input().split()
t = 5 - x[1]
c = 0
for i in range(x[0]):
	y[i] = int(y[i])
	if y[i] <= t:
		c += 1
print(c // 3)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
m = n
for i in range(n):
	if 5 - a[i] < k:
		m = m - 1
print(m // 3)


(m, n) = map(int, input().split(' '))
l = list(map(int, input().split(' ')))
cont = 0
cont12 = 0
for k in l:
	if (5 - k) // n > 0:
		cont += 1
	if cont == 3:
		cont12 += 1
		cont = 0
print(cont12)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
team = 0
y.sort()
for i in range(0, n, 3):
	if i + 3 > n:
		break
	else:
		curr = y[i:i + 3]
		high = max(curr)
		if 5 - high >= k:
			team += 1
print(team)


(a, b) = input().split()
a = int(a)
b = int(b)
s = list(map(int, input().split()))
t = 0
for i in range(a):
	if s[i] + b < 5 or s[i] + b == 5:
		t = t + 1
print(t // 3)


a = list(input().split())
n = int(a[0])
k = int(a[1])
b = list(input().split())
c = []
for i in range(n):
	c.append(int(b[i]))
c = sorted(c)
l = 0
for i in range(2, n, 3):
	if 5 - c[i] >= k:
		l = l + 1
print(l)


(n, m) = map(int, input().split())
li = list(map(int, input().split()))
k = 5 - m
ki = list(filter(lambda a: a <= k, li))
print(len(ki) // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
y.sort()
team = 0
i = 0
while i < len(y) - 2:
	if y[i] + k <= 5 and y[i + 2] + k <= 5:
		team += 1
		i += 3
	else:
		break
print(team)


nk = tuple(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
for i in a:
	if i + nk[1] <= 5:
		ans += 1
print(int(ans / 3))


(n, k) = [int(ch) for ch in input().split()]
x = 0
for num in [int(ch) for ch in input().split(' ')]:
	if num + k <= 5:
		x += 1
res = int(x / 3)
print(res)


(n, k) = map(int, input().strip().split())
students = sorted(list(map(int, input().strip().split())))
answer = 0
students = [s for s in students if s <= 5 - k]
print(len(students) // 3)


__copyright__ = ''
__author__ = 'Son-Huy TRAN'
__email__ = 'sonhuytran@gmail.com'
__doc__ = ''
__version__ = '1.0'

def main() -> int:
	(n, k) = map(int, input().split())
	times = [int(word) for word in input().split()]
	max = 5 - k
	result = sum((1 for time in times if time <= max))
	print(result // 3)
	return 0
exit(main())


students = list(map(int, input().split(' ')))
participated = list(map(int, input().split(' ')))
participated.sort()
count = 0
for i in participated:
	if i <= 5 - students[1]:
		count += 1
	else:
		break
print(count // 3)


(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
(i, cnt) = (0, 0)
a = 5 - k
for u in range(n):
	if lst[u] <= a:
		if i < 4:
			i += 1
		if i == 3:
			i = 0
			cnt += 1
print(cnt)


import sys
numbers = [int(i) for i in sys.stdin.readline().split()]
(n, k) = (numbers[0], numbers[1])
members = [int(i) for i in sys.stdin.readline().split()]
team_members_count = 0
for member in members:
	if member + k <= 5:
		team_members_count += 1
print(team_members_count // 3)


(n, k) = [int(__) for __ in input().strip().split()]
arr = [int(__) for __ in input().strip().split()]
co = 0
for i in arr:
	if 5 - i >= k:
		co += 1
print(co // 3)


import math, sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return list(map(int, input().split()))
nk = invr()
n = nk[0]
k = nk[1]
y = invr()
y.sort()
w = 0
for e in y:
	if e + k < 6:
		w += 1
print(int(w / 3))


(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
for i in range(0, n):
	arr[i] = 5 - arr[i]
arr.sort()
j = n - 1
count1 = 0
team = 0
while j >= 0:
	diff = arr[j] - k
	if diff >= 0:
		count1 += 1
		if count1 == 3:
			team += 1
			count1 = 0
	j -= 1
print(team)


(n, k) = map(int, input().split())
lis = sorted(list(map(int, input().split())))
print(sum((i + k <= 5 for i in lis[2::3])) if n >= 3 else 0)


(n, k) = input().split()
n = int(n)
k = int(k)
y = list(map(int, input().split()))
c = 0
for i in range(n):
	x = 5 - y[i]
	if x >= k:
		c = c + 1
if c >= 3:
	r = int(c / 3)
	print(r)
else:
	print('0')


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
i: int
t = [i for i in s if i <= 5 - k]
print(int(len(t) / 3))


def A423(n, k, array):
	persons = 0
	for i in array:
		if 5 - i >= k:
			persons = persons + 1
	teams = int(persons / 3)
	return teams
inp = input().strip().split(' ')
n = int(inp[0])
k = int(inp[1])
array = input().strip().split(' ')
arr = []
for i in array:
	arr.append(int(i))
result = A423(n, k, arr)
print(result)


(n, k) = [int(x) for x in input().split(' ')]
m = [int(p) for p in input().split(' ')]
for x in range(len(m)):
	m[x] += k
s = [o for o in m if o <= 5]
print(len(s) // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
s = 0
for i in range(n):
	if y[i - 1] <= 5 - k:
		s += 1
	else:
		s += 0
print(s // 3)


(a, b) = map(int, input().split())
c = [int(i) for i in input().split()]
sorted(c)
d = 0
e = 0
for i in range(len(c)):
	if e < 3:
		if c[i] + b <= 5:
			e += 1
	else:
		d += 1
		e = 0
		if c[i] + b <= 5:
			e += 1
if e == 3:
	d += 1
print(d)


(n, k) = [int(x) for x in input().split()]
a = list(map(int, input().split()))
c = [0, 0, 0, 0, 0, 0]
for e in a:
	c[e] += 1
res = 0
for i in range(0, 5 - k + 1):
	res += c[i]
print(int(res / 3))


(n, k) = map(int, input().split())
a = sorted(map(int, input().split()))
t = 0
for i in range(0, n, 3):
	if i + 2 < n and a[i + 2] + k <= 5:
		t += 1
	else:
		break
print(t)


first_list = input()
second_line = input()
(n, k) = first_list.split(' ')
t = 0
for y in second_line.split(' '):
	y = int(y)
	if int(k) <= 5 - y:
		t += 1
print(t // 3)


import sys
import os

def changeStdioToFile():
	path = os.path.dirname(os.path.abspath(__file__))
	sys.stdin = open(f'{path}/input.txt', 'r')
	sys.stdout = open(f'{path}/output.txt', 'w')
t = 1
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	res = 0
	for num in a:
		if 5 - num >= k:
			res += 1
	print(res // 3)


(n, m) = input().split()
n = int(n)
m = int(m)
l = list(map(int, input().split()))
sum = 0
if n > 2:
	for i in range(n - 1):
		if m == 5:
			c = l.count(0)
			print(c // 3)
			break
		elif m == 4:
			c1 = l.count(0)
			c2 = l.count(1)
			sum = c1 + c2
			if sum > 2:
				print(sum // 3)
				break
			else:
				print(0)
				break
		elif m == 3:
			c1 = l.count(0)
			c2 = l.count(1)
			c3 = l.count(2)
			sum = c1 + c2 + c3
			if sum > 2:
				print(sum // 3)
				break
			else:
				print(0)
				break
		elif m == 2:
			c1 = l.count(0)
			c2 = l.count(1)
			c3 = l.count(2)
			c4 = l.count(3)
			sum = c1 + c2 + c3 + c4
			if sum > 2:
				print(sum // 3)
				break
			else:
				print(0)
				break
		else:
			l = list(filter(lambda x: x != 5, l))
			if len(l) > 2:
				print(len(l) // 3)
				break
			else:
				print(0)
				break
else:
	print(0)


(n, k) = [int(x) for x in input().split()]
members = [int(x) for x in input().split()]
times = 0
for i in range(n):
	if 5 - members[i] >= k:
		times += 1
print(times // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
y = sorted(y)
team = 0
for i in range(2, len(y), 3):
	if 5 - y[i] - k >= 0:
		team += 1
print(team)


(n, k) = map(int, input().strip().split(' '))
arr = list(map(int, input().strip().split(' ')))
arr.sort()
(teams, i) = (0, 0)
while i + 2 < n and arr[i + 2] + k <= 5:
	i += 3
	teams += 1
print(teams)


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
(n, k) = get_ints()
li = get_list()
cnt = 0
for i in li:
	if 5 - i >= k:
		cnt += 1
print(cnt // 3)


(n, k) = tuple(map(int, input().split()))
q = list(map(int, input().split()))
cn = 0
for i in q:
	if 5 - i >= k:
		cn += 1
print(cn // 3)


import math
import os
import random
import re
import sys
from operator import itemgetter, attrgetter
(n, k) = [int(x) for x in input().strip().split()]
y = [int(x) for x in input().strip().split()]
r = 0
for p in y:
	if 5 - p >= k:
		r += 1
print('{0}'.format(int(r / 3)))


(n, k) = map(int, input().split())
g = list()
p = list(map(int, input().split()))
for i in range(n):
	if p[i] < 5:
		g.append(p[i])
for i in range(k):
	for h in range(len(g)):
		g[h] = g[h] + 1
f = []
for i in g:
	if i > 5:
		f = f + [i]
for i in f:
	g.remove(i)
print(len(g) // 3)


z = list(map(int, input().split()))
x = list(map(int, input().split()))
a = 0
for i in range(z[0]):
	if x[i] + z[1] < 6:
		a += 1
print(a // 3)


(n, k) = [int(a) for a in input().split()]
PlayedGames = [int(a) for a in input().split()]
eligiblePlayers = n
for index in range(n):
	if PlayedGames[index] > 5 - k:
		eligiblePlayers -= 1
if eligiblePlayers < 3:
	print(0)
else:
	print(eligiblePlayers // 3)


(n, k) = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
fq = [0] * 6
for i in range(n):
	fq[y[i]] += 1
s = 0
for i in range(0, 6 - k):
	s += fq[i]
print(int(s / 3))


(n, d) = input().split()
n = int(n)
d = int(d)
h = list(map(int, input().split()))
s = 0
for i in range(n):
	if h[i] <= 5 - d:
		s += 1
print(s // 3)


(n, k) = [int(x) for x in input().split(' ')]
a = [int(x) for x in input().split(' ')]
ans = 0
while 1:
	a.sort()
	for i in range(len(a)):
		if i >= len(a):
			break
		if 5 - a[i] < k:
			a.remove(a[i])
		else:
			a[i] += k
			ans += 1
			a.remove(a[i])
		if i >= len(a):
			break
	if len(a) == 0:
		break
print(ans // 3)


(n, k) = map(int, input().split())

def yo(n):
	l = int(n)
	return 5 - l
list1 = list(map(yo, input().split()))
count = 0
for i in list1:
	if i >= k:
		count += 1
print(count // 3)


def numberOfTeams(arr, k):
	limit = 5 - k
	count = 0
	for (idx, val) in enumerate(arr):
		if val <= limit:
			count += 1
	return count // 3
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
print(numberOfTeams(arr, k))


(n, k) = map(int, input().split())
print(len([1 for _ in list(map(int, input().split())) if 5 - _ >= k]) // 3)


(n, k) = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
m = 0
for i in range(n):
	y[i] = 5 - y[i]
y.sort()
if y[0] >= k:
	m = n
else:
	for i in range(1, n):
		if y[i - 1] < k <= y[i]:
			m = n - i
			break
print(m // 3)


l1 = input().split(' ')
l1 = [int(x) for x in l1]
l2 = input().split(' ')
l2 = [int(x) for x in l2 if 5 - int(x) >= l1[1]]
print(int(len(l2) / 3))


def R():
	return map(int, input().split())

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
(n, k) = R()
y = L()
print(sum([y[i] < 6 - k for i in range(n)]) // 3)


nk = list(map(int, input().split()))
count = 0
allowed = 5 - nk[1]
NoOfPeople = list(map(int, input().split()))
for lol in range(nk[0]):
	if NoOfPeople[lol] <= allowed:
		count += 1
print(int(count / 3))


(n, k) = input().split()
(n, k) = (int(n), int(k))
a = [int(ae) for ae in input().split()]
d = {x: 0 for x in range(6)}
s = 0
for i in a:
	d[i] = d[i] + 1
for i in range(5 - k + 1):
	s = s + d[i]
h = s // 3
print(h)


[n, k] = list(map(int, input().split()))
arr = list(map(int, input().split()))
ans = 0
ansarr = [0] * 6
for i in arr:
	ansarr[i] += 1
for i in range(5 - k + 1):
	ans += ansarr[i]
print(ans // 3, end='')


def main():
	(n, k) = map(int, input().split())
	p = list(map(int, input().split()))
	c = 0
	for i in p:
		if i + k < 6:
			c += 1
	print(c // 3)
main()


(n, k) = map(int, input().split())
lis = list(map(int, input().split()))
tar = 5 - k
c = 0
for i in lis:
	if i <= tar:
		c += 1
print(c // 3)


kk = input()
te = input()
arr = te.split()
k1 = kk.split()
times = int(k1[1])
tx = []
ind = 0
for i in sorted(arr):
	ind += 1
	if ind % 3 == 0:
		tx.append(int(i))
nn = len(tx)
for i in range(nn):
	tx[i] += times
total = 0
for i in tx:
	if i <= 5:
		total += 1
print(total)


(n, k) = map(int, input().split())
c = 0
a = sorted(list(map(int, input().split())))
for i in range(2, n, 3):
	if a[i] + k <= 5:
		c += 1
print(c)


_ = input
b = int(_().split()[1])
print(sum((1 for i in map(int, _().split()) if i + b < 6)) // 3)


(a, b) = map(int, input().split())
c = list(map(int, input().split()))
x = k = int(0)
while x < a:
	c[x] = c[x] + b
	x = x + 1
for x in c:
	if x <= 5:
		k = k + 1
print(k // 3)


(m, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
count = 0
i = 0
while i < m - 2:
	if a[i + 2] + k <= 5:
		count = count + 1
	i = i + 3
print(count)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
l = list(filter(lambda x: x + k <= 5, l))
print(len(l) // 3)


(n, k) = map(int, input().split())
arr = map(int, input().split())
plr = 0
for i in arr:
	if 5 - i >= k:
		plr += 1
print(plr // 3)


(a, b) = map(int, input().split())
n = list(map(int, input().split()))
n = [5 - i for i in n]
n.sort()
c = 0
for i in range(a):
	if n[i] < b:
		c += 1
	else:
		break
print((len(n) - c) // 3)


(n, k) = [int(x) for x in input().split()]
S = [int(x) for x in input().split()]
num = 3
T = S
T.sort()
teams = 0
K = [T[r * num:(r + 1) * num] for r in range(0, len(T) // 2)]
for i in range(len(K)):
	if len(K[i]) < 3:
		break
	for j in range(len(K[i])):
		if K[i][j] > 5 - k:
			break
	else:
		teams += 1
print(teams)


def read_array():
	x = []
	x1 = []
	x = input()
	x = x.split(' ')
	for r in range(len(x)):
		x1.append(int(x[r]))
	return x1

def numb_of_teams(vector, k):
	teams = []
	count = 0
	for v in vector:
		teams.append(v + k)
	for u in teams:
		if u <= 5:
			count += 1
	return count // 3
k = read_array()
x = read_array()
print(numb_of_teams(x, k[1]))


(a, b) = map(int, input().split())
c = 0
x = input().split()
for i in range(a):
	n = x[i]
	if int(n) + int(b) <= 5:
		c += 1
print(int(c / 3))


line = input()
(N, K) = line.split()
(n, k) = (int(N), int(K))
list1 = [int(i) for i in input().split()]
m = 5 - k
list2 = []
for i in list1:
	if i <= m:
		list2.append(i)
print(len(list2) // 3)


nk = input().split()
n = int(nk[0])
k = int(nk[1])
count = 0
L = list(map(int, input().split()))
for i in range(0, n):
	if L[i] + k <= 5:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
z = 5 - k
pl = list(filter(lambda x: x <= z, y))
totem = len(pl) // 3
print(totem)


def trial():
	(n, k) = list(map(int, input().split()))
	nums = list(map(int, input().split()))
	new = [i + k for i in nums]
	counter = 0
	for i in new:
		if i <= 5:
			counter += 1
	return print(counter // 3)
trial()


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict
import bisect
import heapq as hq

def main():
	try:
		(n, m) = map(int, input().split())
		l = list(map(int, input().split()))
		t = 5 - m
		l.sort()
		ans = 0
		for i in range(n):
			if l[i] <= t:
				ans += 1
			else:
				break
		print(ans // 3)
	except:
		pass
P = 1000000007
main()


[n, k] = list(map(int, input().split()))
print(len([j for j in list(map(int, input().split())) if 5 - j >= k]) // 3)


while True:
	try:
		s = input().split(' ')
		t = list(map(int, input().split(' ')))
		t = list(filter(lambda x: x + int(s[1]) <= 5, t))
		print(len(t) // 3)
	except:
		break


l = list(map(int, input().split(' ')))
n = l[0]
k = l[1]
m = 5 - k
total = 0
a = list(map(int, input().split(' ')))
if m < 0:
	print('0')
else:
	for i in a:
		if i <= m:
			total = total + 1
print(int(total / 3))


import sys

def data():
	return sys.stdin.readline().strip()

def sp():
	return map(int, data().split())

def l():
	return list(sp())
temp = l()
n = temp[0]
k = temp[1]
times = l()
c = 0
for j in times:
	if j <= 5 - k:
		c += 1
print(c // 3)


(n, k) = [int(i) for i in input().split(' ')]
setup = [int(i) + k for i in input().split(' ')]
select = []
for x in setup:
	if x <= 5:
		select.append(x)
print(int(len(select) / 3))


(n, k) = map(int, input().split())
students = [int(x) for x in input().split()]
students.sort()
res = 0
temp = 0
for i in students:
	if i + k <= 5:
		temp += 1
		if temp == 3:
			res += 1
			temp = 0
	else:
		break
print(res)


(n, k) = map(int, input().split())
x = [int(i) for i in input().split()]
x.sort()
kom = len(x) // 3
s = 0
if kom >= 1:
	for i in range(kom):
		if max(x[:3]) + k <= 5:
			s = s + 1
			x = x[3:]
	print(s)
else:
	print(0)


[n, k] = [int(x) for x in input().split()]
playerList = [int(x) for x in input().split()]
i = 0
for i in range(n):
	playerList[i] -= 5
	playerList[i] += k
eligible = 0
for player in playerList:
	if player <= 0:
		eligible += 1
print(eligible // 3)


(n, k) = [int(x) for x in input().split()]
forces = [int(x) for x in input().split()]
cnt = 0
for i in forces:
	cnt += i + k <= 5
print(cnt // 3)


(n, k) = map(int, input().split())
num = [int(i) for i in input().split()]
num1 = []
s = 0
for i in num:
	if i + k < 6:
		num1.append(i)
s = len(num1) // 3
print(s)


from sys import exit
(n, k) = map(int, input().split(' '))
arr = list(map(int, input().split()))
arr.sort()
if n < 3:
	print('0')
	exit(0)
else:
	team = 0
	for i in range(2, n, 3):
		if 5 - arr[i] >= k:
			team += 1
	print(team)


(n, k) = map(int, input().split())
members = list(map(int, input().split()))
members.sort()
no_of_players = 0
for person in members:
	if 5 - person >= k:
		no_of_players += 1
	else:
		break
print(no_of_players // 3)


(a, b) = map(int, input().split())
x = [*map(int, input().split())]
_ = [i for i in x if i + b < 6]
print(len(_) // 3)


from bisect import *
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
cn = 0
d = 5 - k
cn = bisect(a, 5 - k)
ans = cn // 3
print(ans)


import bisect
(n, k) = list(map(int, input().split()))
rem = list(map(int, input().split()))
for i in range(n):
	rem[i] = 5 - rem[i]
rem.sort()
print((n - bisect.bisect_left(rem, k, 0, n)) // 3)


(n, k) = map(int, input().split())
count = 0

def fu(x):
	if int(x) + k <= 5:
		global count
		count += 1
l = list(map(fu, input().split()))
print(count // 3)


def main():
	(n, k) = map(int, input().split())
	y = [yi + k for yi in map(int, input().split())]
	print(sum((yi <= 5 for yi in y)) // 3)
main()


(n, k) = [eval(s) for s in input().split()]
array = [eval(s) for s in input().split()]
array.sort()
team = 0
if n < 3:
	print(0)
else:
	i = 2
	while i < n:
		if array[i] <= 5 - k:
			team += 1
		i += 3
	print(team)


e = list(map(int, input().split()))
s = list(map(int, input().split()))
s = list(filter(lambda x: 5 - x >= e[1], s))
print(len(s) // 3)


def answer():
	a = input().split()
	a = [int(x) for x in a]
	n = a[0]
	k = a[1]
	c = input().split()
	c = [int(x) for x in c]
	i = 0
	ans = 0
	people = 0
	while i < len(c):
		if c[i] + k <= 5:
			people += 1
		i += 1
	ans = int(people / 3)
	return ans
print(answer())


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
l1 = [x + k for x in l]
count = 0
i = 2
while i < n and l1[i] <= 5:
	if l1[i] <= 5:
		count += 1
	i += 3
print(count)


(n, k) = [int(x) for x in input().split(' ')]
list1 = [int(x) for x in input().split(' ')]
n0 = 0
for i in list1:
	if i <= 5 - k:
		n0 += 1
print(int(n0 / 3))


(r, k) = map(int, input().split())
s = 0
mas = list(map(int, input().split()))
for i in mas:
	i += k
	if i <= 5:
		s += 1
print(s // 3)


n = list(map(int, input().split(' ')))
l = list(map(int, input().split(' ')))
p = []
for i in l:
	if i + n[1] <= 5:
		p.append(i)
print(len(p) // 3)


def read():
	return [int(c) for c in input().split()]

def main():
	(_n, k) = read()
	students = read()
	ans = sum((y <= 5 - k for y in students)) // 3
	print(ans)
main()


(n, k) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
cnt = 0
for e in l:
	if e <= 5 - k:
		cnt += 1
print(cnt // 3)


(times, limit) = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
for i in range(len(a)):
	if 5 - a[i] >= limit:
		cnt = cnt + 1
print(int(cnt / 3))


(n, k) = [int(x) for x in input().split()]
y = [int(yi) for yi in input().split()]
y.sort()
counter = 0
for i in range(2, len(y), 3):
	if y[i] <= 5 - k:
		counter += 1
print(counter)


(n, k) = list(map(int, input().split()))
times = sorted(map(int, input().split()))
count = 0
for i in range(n):
	if 5 - times[i] >= k:
		count += 1
print(int(count / 3))


(n, k) = map(int, input().split())
a = map(int, input().split())
people = 0
for _ in a:
	if _ <= 5 - k:
		people += 1
print(people // 3)


(n, k) = [int(x) for x in input().split(' ')]
y = [int(z) for z in input().split(' ')]
count = 0
for i in y:
	if i <= 5 - k:
		count += 1
print(int(count / 3))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
	a[i] += k
a = sorted(a)
c = 0
i = 0
while i <= n - 3:
	s = a[i:i + 3]
	k = 0
	z = 0
	for j in s:
		z = 1
		if j > 5:
			k = 1
			break
	if k == 0 and z == 1:
		c += 1
	else:
		break
	i = i + 3
print(c)


a = input().split()
s = input().split()
d = 0
for i in s:
	if int(i) + int(a[1]) <= 5:
		d += 1
print(d // 3)


(n, k) = map(int, input().split())
l = list(sorted(map(int, input().split())))
c = 0
for i in range(2, len(l), 3):
	if 5 - l[i] >= k:
		c += 1
	else:
		break
print(c)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(n):
	if 5 - a[i] < m:
		break
	if i == n - 1:
		i += 1
print(i // 3)


str = input()
n = int(str.split(' ')[0])
k = int(str.split(' ')[1])
t = input()
slist = t.split(' ')
count = int(0)
for i in slist:
	if 5 - int(i) >= k:
		count += 1
print(int(count / 3))


(n, k) = map(int, input().strip().split(' '))
y = list(map(int, input().strip().split(' ')))
y.sort(reverse=True)
for i in range(n):
	if y[i] + k <= 5:
		break
print((n - i) // 3)


(n, k) = list(map(int, input().split(' ')))
arr = list(map(int, input().split(' ')))
print(sum((1 if arr[i] <= 5 - k else 0 for i in range(n))) // 3)


(n, k) = [int(i) for i in input().split(' ')]
li = [int(i) for i in input().split(' ')]
cnt = 0
for i in range(n):
	if 5 - li[i] >= k:
		cnt += 1
print(cnt // 3)


s = input().split(' ')
(n, k) = (int(s[0]), int(s[1]))
q = input().split(' ')
stan = 5 - k
count = 0
for i in range(n):
	if int(q[i]) <= stan:
		count += 1
print(count // 3)


from sys import stdin
i = [[int(y) for y in x.rstrip().split()] for x in stdin.readlines()]
size = i[0][1]
red = list(filter(lambda x: x <= 5 - size, i[1]))
print(len(red) // 3)


(n, k) = map(int, input().split())
v = list(map(int, input().split()))
v.sort()
i = -1
ans = 0
while i + 3 < len(v):
	i += 3
	if v[i] + k <= 5:
		ans += 1
print(ans)


import pdb
c = 0
(stu, at) = map(int, input().split())
y = map(int, input().split())
p = sorted(y)
x = 5 - at
for i in p:
	if i <= x:
		c += 1
print(c // 3)


(n, k) = map(int, input().split())
b = sorted([int(i) for i in input().split()])
num = 0
i = 0
while i <= n - 3:
	if 5 - b[i] >= k and 5 - b[i + 1] >= k and (5 - b[i + 2] >= k):
		num += 1
		i += 3
	else:
		i += 1
print(num)


(n, k) = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
x1 = [5 - i for i in y]
x2 = []
for i in range(n):
	if x1[i] <= 5:
		x2.append(x1[i] // k)
	else:
		x2.append(5 // k)
total = 0
for j in range(len(x2)):
	if x2[j] > 0:
		total += 1
print(total // 3)


(n, k) = map(int, input().split())
arr = [int(i) for i in input().split()]
ans = 0
for i in range(n):
	if arr[i] + k <= 5:
		ans += 1
print(ans // 3)


(n, k) = [int(x) for x in input().split()]
l = [int(x) for x in input().split()]
res = 0
for i in range(n):
	if l[i] + k <= 5:
		res += 1
print(res // 3)


import math
s = 0
(n, k) = input().split()
n = int(n)
k = int(k)
g = [int(i) for i in input().split()]
for nr in range(0, n):
	if g[nr] + k <= 5:
		s = s + 1
print(math.floor(s / 3))


(n, k) = input().split()
(n, k) = (int(n), int(k))
r = []
arr = list(map(int, input().split()))
lst = [ele + k for ele in arr]
for i in lst:
	if i <= 5:
		r.append(i)
print(len(r) // 3)


data = input().split()
std_times = input().split()
(N, K) = (int(data[0]), int(data[1]))
std_times = sorted(list(map(int, std_times)))
teams = 0
i = 0
while i < N:
	if std_times[i] + K <= 5:
		teams += 1
	i += 1
print(teams // 3)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
B = []
for i in range(n):
	if A[i] + k <= 5:
		B.append(A[i])
print(len(B) // 3)


def teams(n):
	return n // 3
(n, k) = list(map(int, input().split()))
s = list(map(int, input().split()))
count = 0
for i in s:
	if i + k <= 5:
		count += 1
print(teams(count))


import math
s = 0
(n, k) = input().split()
n = int(n)
k = int(k)
d = [int(s) for s in input().split()]
for numb in d:
	if numb <= 5 - k:
		s = s + 1
print(math.floor(s / 3))


(n, m) = map(int, input().split())
lt = list(map(int, input().split()))
nlt = []
for i in lt:
	if 5 - i >= m:
		nlt.append(i)
print(len(nlt) // 3)


inp = input().split()
n = int(inp[0])
k = int(inp[1])
a = input().split()
cnt = 0
for i in range(n):
	if 5 - int(a[i]) >= k:
		cnt += 1
print(cnt // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
a = []
for i in l:
	if i + k <= 5:
		a.append(i)
le = len(a)
print(le // 3)


s = input()
st = s.split()
n = int(st[0])
join = int(st[1])
count = 0
new = input()
total = new.split()
person = []
for i in range(len(total)):
	t = int(total[i])
	person.append(t)
for i in range(n):
	if person[i] + join <= 5:
		count = count + 1
print(count // 3)


s = list(map(int, input().split()))
a = list(map(int, input().split()))
t = []
for i in range(len(a)):
	if 5 - a[i] >= s[1]:
		t.append(a[i])
if len(t) >= 3:
	print(len(t) // 3)
else:
	print('0')


(n, k) = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
team = 0
for i in y:
	if i <= 5 - k or i == 0:
		team += 1
print(int(team / 3))


(n, k) = map(int, input().split(' '))
li = list(map(int, input().split(' ')))
li = sorted(li)
if len(li) % 3 == 1:
	li.pop(-1)
if len(li) % 3 == 2:
	li.pop(-1)
	li.pop(-1)
groups = list(zip(*(iter(li),) * 3))
res = 0
for i in groups:
	if max(i) <= 5 - k:
		res += 1
print(res)


(n, k) = map(int, input().split())
temp = str(5 - k)
print(sum((i <= temp for i in input().split())) // 3)


(a, b) = map(int, input().split())
w = [int(i) for i in input().split()]
q = 0
z = 0
for i in w:
	if 5 - b >= i:
		q += 1
	else:
		continue
	if q % 3 == 0:
		z += 1
		q -= 3
print(z)


def solve(k, l):
	_max = 5 - k
	count = 0
	for i in l:
		if i <= _max:
			count += 1
	return int(count / 3)
(n, k) = map(int, input().split())
l = map(int, input().split())
print(solve(k, l))


a = list((int(x) for x in input().split()))
b = list((int(x) for x in input().split()))
b.sort()
c = 0
for i in b:
	if i <= 5 - a[1]:
		c += 1
	else:
		pass
print(c // 3)


(n, k) = map(int, input().split())
ti = list(map(int, input().split()))
sum = 0
for i in range(n):
	ti[i] = 5 - ti[i]
	if ti[i] >= k:
		sum += 1
ans = sum // 3
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in a:
	ans += k + i <= 5
print(ans // 3)


try:
	c = 0
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	for i in range(0, n):
		if l[i] <= 5 - k:
			c += 1
	print(c // 3)
except Exception:
	pass


def choosing_teams(n, k, a=[]):
	cnt = 0
	for i in range(n):
		if 5 - a[i] >= k:
			cnt += 1
	return cnt // 3
[n, k] = map(int, input().split())
a = []
a.extend(list(map(int, input().split())))
result = choosing_teams(n, k, a)
print(result)


k = int(input()[-1])
print(len(list(filter(lambda p: p + k <= 5, map(int, input().split())))) // 3)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr = list(map(lambda x: x + k, arr))
arr = [i for i in arr if i <= 5]
print(len(arr) // 3)


(n, k) = [int(t) for t in input().split()]
arr = [int(t) for t in input().split()]
cnt = 0
for i in range(0, n):
	if 5 - arr[i] >= k:
		cnt += 1
print(cnt // 3)


(n, k) = input().split()
(n, k) = (int(n), int(k))
record = input().split()
for i in range(n):
	record[i] = int(record[i])
teams = 0
count = 0
for i in range(n):
	if 5 - record[i] >= k:
		count += 1
teams = count // 3
print(teams)


(n, k) = map(int, input().split(' '))
li = list(map(int, input().split(' ')))
i = 0
count = 0
while i < n:
	if li[i] + k <= 5:
		count += 1
	i += 1
print(count // 3)


import sys

def main():
	_count = 0
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	for i in range(n):
		a[i] += k
		if a[i] < 6:
			_count += 1
	print(int(_count / 3))
sys.exit(main())


from math import *
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
t = []
for i in a:
	if i <= 5 - k:
		t.append(i)
	else:
		pass
print(floor(len(t) / 3))


(n, k) = list(map(int, input().split()))
y = list(map(int, input().split()))
y = sorted(y)
count = 0
for num in y:
	if num > 5 - k:
		break
	count += 1
print(count // 3)


integer = int
inp = input
mp = map
(n, k) = mp(integer, inp().split())
contestants = 0
for i in mp(integer, inp().split()):
	if i + k < 6:
		contestants += 1
print(contestants // 3, end='')


a = input()
a = a.split()
a1 = int(a[0])
a2 = int(a[1])
b = input()
b = b.split()
con = 0
cont = 0
for k in range(a1):
	if int(b[k]) + a2 <= 5:
		con = con + 1
	if con == 3:
		cont = cont + 1
		con = 0
print(cont)


(n, k) = map(int, input().split())
m = list(map(int, input().split()))
m.sort()
a = 0
b = 0
for i in range(n // 3):
	if max(m[b:b + 3]) + k <= 5:
		a += 1
		b += 3
print(a)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]
(n, k) = value()
a = [5 - int(i) for i in input().split()]
ans = 0
for i in a:
	if i >= k:
		ans += 1
print(ans // 3)


def nteams(qual, nlst):
	count = 0
	if qual < 0:
		return 0
	else:
		for x in nlst:
			if x <= qual:
				count += 1
		return count // 3
(n, k) = map(int, input().split())
nlst = list(map(int, input().strip().split()))
qual = 5 - k
nt = nteams(qual, nlst)
print(nt)


(n, k) = map(int, input().split())
p = [int(y) for y in input().split()]
e = []
for i in p:
	if i <= 5 - k:
		e.append(i)
print(len(e) // 3)


(n, k) = [int(string) for string in input().split()]
boys_all = [int(string) for string in input().split()]
print(len([boy for boy in boys_all if boy <= 5 - k]) // 3)


(n, k) = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]
val = 5 - k
c = 0
for i in arr:
	if i <= val:
		c += 1
print(c // 3)


(n, k) = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
d = 0
for i in y:
	if i <= 5 - k:
		d += 1
print(int(d / 3))


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
ii = lambda : int(input())
si = lambda : input()
jn = lambda x, l: x.join(map(str, l))
sl = lambda : list(map(str, input().strip()))
mi = lambda : map(int, input().split())
mif = lambda : map(float, input().split())
lii = lambda : list(map(int, input().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007
(n, k) = mi()
arr = lii()
count = 0
for ele in arr:
	if 5 - ele >= k:
		count += 1
print(count // 3)


(n, g) = input().split()
n = int(n)
g = int(g)
gadi = list(map(int, input().split()))
m = [0, 0, 0, 0, 0, 0]
for x in gadi:
	m[x] = m[x] + 1
sum = 0
for i in range(0, 6 - g):
	sum = sum + m[i]
print(int(sum / 3))


(n, r) = map(int, input().split())
studs = list(map(int, input().split()))
e = 0
for i in studs:
	if i <= 5 - r:
		e += 1
print(e // 3)


def solve(n, k, par):
	par = sorted(par)
	teams = 0
	for i in range(0, n, 3):
		if i + 1 < n and i + 2 < n:
			pl1 = par[i] + k
			pl2 = par[i + 1] + k
			pl3 = par[i + 2] + k
			if pl1 <= 5 and pl2 <= 5 and (pl3 <= 5):
				teams += 1
	print(teams)
(n, k) = [int(y) for y in input().split()]
par = [int(y) for y in input().split()]
solve(n, k, par)


(n, k) = map(int, input().split())
info = list(map(int, input().split()))
counter = 0
for i in range(n):
	info[i] += k
	if info[i] <= 5:
		counter += 1
print(counter // 3)


(n, k) = map(int, input().split(' '))
num = list(map(int, input().split(' ')))
count = 0
counter = 0
for i in range(n):
	result = 5 - num[i]
	if result >= k:
		count = count + 1
		if count == 3:
			counter = counter + 1
			count = 0
		else:
			continue
	else:
		continue
print(counter)


(a, b) = map(int, input().split())
lst = list(map(int, input().split()))
b = 5 - b
count = 0
for i in lst:
	if i <= b:
		count += 1
print(count // 3)


s = input().split()
a = int(s[0])
b = int(s[1])
l = input().split()
res = 0
piko = 0
for i in range(a):
	l[i] = int(l[i]) + b
for i in l:
	if i < 6:
		piko += 1
	if piko == 3:
		res += 1
		piko = 0
print(res)


(n, k) = list(map(int, input().rstrip().split()))
y = list(map(int, input().rstrip().split()))
l = []
for x in y:
	if 5 - x >= k:
		l += [x]
n = len(l) // 3
print(n)


lst = list(map(int, input().split()))
(n, k) = (lst[0], lst[1])
participates = list(map(int, input().split()))
tm = 0
for i in participates:
	if i + k <= 5:
		tm += 1
print(tm // 3)


(x, y) = map(int, input().split(' '))
z = list(map(int, input().split(' ')))
c = 0
for i in range(len(z)):
	if z[i] + y <= 5:
		c += 1
print(c // 3)


def main():
	try:
		t = input()
		s = t.split(' ')
		n = int(s[0])
		k = int(s[1])
		t = input()
		s = t.split(' ')
		ans = 0
		for i in range(n):
			if int(s[i]) + k <= 5:
				ans = ans + 1
		print(int(ans / 3))
	except EOFError:
		return

def __starting_point():
	main()
__starting_point()


(n, k) = map(int, input().split())
m = [int(x) + k for x in input().split()]
num = 0
x = [True] * n
for i in range(n):
	if m[i] > 5:
		x[i] = False
for i in x:
	if i:
		num += 1
print(num // 3)


(a, b) = input().split()
(a, b) = (int(a), int(b))
c = input().split(maxsplit=a)
c = sorted([int(i) for i in c if int(i) + b <= 5])
print(len(c) // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
e = 0
for i in range(0, n, 3):
	if i + 3 < n + 1:
		a = max(l[i:i + 3])
		if 5 - a >= k:
			e += 1
print(e)


(n, k) = [int(item) for item in input().split()]
y = [int(item) for item in input().split()]
k = 5 - k
ctr = 0
for i in y:
	if i <= k:
		ctr += 1
print(ctr // 3)


def solve(n, k, par):
	par = sorted(par)
	teams = 0
	for i in range(0, n, 3):
		if i + 1 < n and i + 2 < n:
			p1 = par[i] + k
			p2 = par[i + 1] + k
			p3 = par[i + 2] + k
			if p1 <= 5 and p2 <= 5 and (p3 <= 5):
				teams += 1
	print(teams)
(n, k) = map(int, input().split())
par = map(int, input().split())
solve(n, k, par)


(n, k) = input().split()
n = int(n)
k = int(k)
playask = 0
playa = list(map(int, input().split()))
for i in range(0, n):
	if playa[i] + k <= 5:
		playask = playask + 1
print(playask // 3)


[n, k] = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
(i, ans) = (0, 0)
for i in range(0, n - 2, 3):
	b = [j for j in a[i:i + 3] if j <= min(4, 5 - k)]
	if len(b) == 3:
		ans += 1
print(ans)


(a, b) = map(int, input().split())
l = sorted(list(map(int, input().split())))
r = 0
for i in range(2, a, 3):
	if l[i] + b <= 5:
		r += 1
	else:
		break
print(r)


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for i in A:
	if i + m <= 5:
		ans += 1
print(ans // 3)


(num, t) = map(int, input().split())
print(len([1 for i in map(int, input().split()) if 5 - i >= t]) // 3)


nk = input()
(n, k) = (int(i) for i in nk.split())
nums = input()
nums = [int(i) for i in nums.split()]
count = 0
for i in nums:
	if i + k <= 5:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
cnt = 0
a = sorted(list(map(int, input().split())))
for i in a:
	if i + k <= 5:
		cnt += 1
	else:
		break
print(cnt // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
for i in range(1, len(l) + 1):
	if l[i - 1] > 5 - k:
		i -= 1
		break
print(i // 3)


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
minimum = 5 - b
count = 0
for i in l:
	if i <= minimum:
		count += 1
	else:
		pass
print(count // 3)


(n, k) = map(int, input().split(' '))
alumnos = list(map(int, input().split(' ')))
alumnos.sort()
available = 0
for alumno in alumnos:
	if alumno + k <= 5:
		available += 1
print(available // 3)


(n, k) = [int(a) for a in input().split(' ')]
y = [int(a) for a in input().split(' ')]
print(len([x for x in y if x <= 5 - k]) // 3)


def main():
	(n, k) = map(lambda x: int(x), input().split())
	participations = list(map(lambda x: int(x), input().split()))
	validParticipants = 0
	for part in participations:
		if part + k <= 5:
			validParticipants += 1
	print(validParticipants // 3)
main()


(num, atle) = [int(x) for x in input().split()]
stu = [int(x) for x in input().split()]
num_canat = 0
for i in range(num):
	n = stu[i] + atle
	if n <= 5:
		num_canat += 1
print(int(num_canat / 3))


s = input().split(' ')
n = int(s[0])
k = int(s[1])
a = input().split(' ')
s = 0
for i in range(n):
	a[i] = int(a[i]) + k
	if a[i] <= 5:
		s += 1
print(s // 3)


(numberOfStudents, expectedParticipations) = [int(i) for i in input().split(' ')]
students = sorted([int(i) for i in input().split(' ')])
teams = 0
for i in range(numberOfStudents):
	if 5 - students[i] >= expectedParticipations:
		teams = teams + 1
print(teams // 3)


(n, k) = input().split()
noyear = input().split()
count = 0
for z in range(int(n)):
	noyear[z] = 5 - int(noyear[z])
	if noyear[z] >= int(k):
		count = count + 1
print(int(count / 3))


(n, k) = map(int, input().split())
list_1 = sorted(list(map(int, input().split())))
newList = list(map(lambda x: x + k, list_1))
sum_1 = 0
for num in newList:
	if num <= 5:
		sum_1 += 1
print(sum_1 // 3)


import math
t = input()
temp = t.split()
n = int(temp[0])
k = int(temp[1])
s = input()
temp = s.split()
numbers = [int(i) for i in temp]
allowedNumber = 5 - k
count = 0
for number in numbers:
	if number <= allowedNumber:
		count += 1
print(math.floor(count / 3))


def inpNum():
	return int(input())

def inpNums():
	return map(int, input().split())

def inpList():
	return list(map(int, input().split()))
(n, k) = inpNums()
members = 0
for v in sorted(inpList()):
	if v + k <= 5:
		members += 1
print(members // 3)


a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
total = 0
for i in range(a[0]):
	if b[i] + a[1] <= 5:
		total += 1
print(int(total / 3))


(a, b) = map(int, input().split(' '))
list1 = [int(x) for x in input().split(' ')]
cou = 0
for i in range(len(list1)):
	if 5 >= b + list1[i]:
		cou += 1
print(cou // 3)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
m = len(a)
count = 0
zcount = 0
for i in range(m):
	if a[i] < 5 and a[i] <= 5 - k:
		count += 1
	if count == 3:
		zcount += 1
		count = 0
print(zcount)


(n, k) = map(int, input().split())
li = [int(x) for x in input().split()]
new = [x + k for x in li if x + k <= 5]
print(len(new) // 3)


(n, m) = map(int, input().split())
k = list(map(int, input().split()))
for i in range(m):
	for j in range(len(k)):
		k[j] += 1
k2 = []
k1 = []
for j in k:
	if j <= 5:
		k1.append(j)
		if len(k1) == 3:
			k2.append(k1)
			k1 = []
print(len(k2))


(n, k) = [int(i) for i in input().split()]
S = [int(i) for i in input().split()]
ll = 0
for i in range(n):
	if S[i] + k <= 5:
		ll += 1
print(ll // 3)


(n, k) = list(map(int, input().split()))
inp = list(map(int, input().split()))
cntr = 0
for i in range(n):
	if inp[i] <= 5 - k:
		cntr += 1
print(cntr // 3)


(n, k) = map(int, input().split())
li = list(map(int, input().split()))
li.sort(reverse=True)
k1 = []
for i in li:
	if 5 - i >= k:
		k1.append(i)
print(len(k1) // 3)


(n, k) = list(map(int, input().split()))
m = list(map(int, input().split()))
c = 0
u = 0
for i in m:
	y = 5 - i
	if y >= k:
		u += 1
	if u == 3:
		c += 1
		u = 0
print(c)


def func(arr, k):
	cnt = 0
	for ele in arr:
		if ele + k <= 5:
			cnt += 1
	return cnt // 3
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
print(func(arr, k))


(n, k) = map(int, input().split())
y = [int(x) for x in input().split()]
y.sort()
l = [5 - y[i] for i in range(n)]
m = []
t = 0
for j in range(n):
	if l[j] > k or l[j] == k:
		m.append(l[j])
		if len(m) % 3 == 0:
			t += 1
print(t)


(n, k) = list(map(int, input().split()))
y = list(map(int, input().split()))
mark = list(filter(lambda x: x + k <= 5, y))
print(len(mark) // 3)


(n, k) = map(int, input().split())
array = list(map(int, input().split()))
persons = 0
for _ in range(k):
	for i in range(len(array)):
		array[i] += 1
for i in array:
	if i <= 5:
		persons += 1
print(persons // 3)


(n, k) = map(int, input().split())
count = 0
l = map(int, input().split())
for h in l:
	if h + k <= 5:
		count += 1
print(int(count / 3))


(n, k) = map(int, input().split())
y = [int(x) for x in input().split()]
s = 0
for i in range(0, 6 - k):
	s += y.count(i)
print(int(s / 3))


(a, b) = map(int, input().strip().split())
p = list(map(int, input().split()))
c = 0
for n in range(a):
	if p[n] <= 5 - b:
		c = c + 1
print(c // 3)


def main():
	nums = [int(x) for x in input().split(' ')]
	team_num = nums[0]
	years = nums[1]
	teams = [int(x) for x in input().split(' ')]
	res = 0
	for team in teams:
		if team + years <= 5:
			res += 1
	print(res // 3)
main()


(n, k) = map(int, input().split())
lista = [int(x) for x in input().split()]
cont = 0
for x in range(n):
	if lista[x] + k <= 5:
		cont += 1
print(cont // 3)


(n, k) = map(int, input().split())
lyst = [int(i) for i in input().split(' ')]
lyst.sort()
main_lyst = []
for i in lyst:
	if i + k < 6:
		main_lyst.append(i + k)
	else:
		pass
print(len(main_lyst) // 3)


(n, k) = input().split()
n = int(n)
k = int(k)
l = input().split()
for i in range(n):
	l[i] = int(l[i])
l1 = 0
i = 0
while i <= 5 - k:
	l1 += l.count(i)
	i += 1
print(l1 // 3)


a = list(map(int, input().split()))
n = a[0]
k = a[-1]
b = list(map(int, input().split()))
b.sort()
count = 0
for x in b:
	if x + k <= 5:
		count += 1
print(int(count / 3))


import math
from collections import Counter

def get(f):
	return map(f, input().split())

def divides(a, b):
	return a % b == 0

def main():
	(n, k) = get(int)
	people = list(filter(lambda x: x + k <= 5, get(int)))
	print(math.floor(len(people) / 3))
main()


import math
y = list(map(int, input().split()))
z = list(map(int, input().split()))
p = 0
for i in z:
	if i <= 5 - y[1]:
		p += 1
print(math.floor(p / 3))


(n, k) = map(int, input().split())
s = [int(i) for i in input().split()]
g = 0
t = 0
for i in s:
	j = 5 - i
	if j >= k:
		t = t + 1
	if t == 3:
		g = g + 1
		t = 0
print(g)


(n, k) = map(int, input().split())
l = [*map(int, input().split())]
l.sort()
i = 0
count = 0
while i < n:
	if l[i] + k <= 5:
		count += 1
	i += 1
print(count // 3)


li = list(map(int, input().split()))
li2 = list(map(int, input().split()))
li2 = sorted(li2)
res = 0
rot = int(li[0] / 3)
while rot:
	if max(li2[:3]) + li[1] <= 5:
		res += 1
	for val in li2[:3]:
		li2.remove(val)
	rot -= 1
print(res)


nk = [int(x) for x in input().split()]
data = [int(x) for x in input().split()]
data = [x for x in data if x + nk[1] < 6]
print(len(data) // 3)


(kol, raz) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = 0
for i in range(kol):
	if a[i] + raz > 5:
		continue
	elif a[i] + raz <= 5:
		b = b + 1
print(b // 3)


(n, k) = map(int, input().split())
p_list = list(map(int, input().split()))
cont = 0
for i in p_list:
	if i <= 5 - k:
		cont += 1
print(cont // 3)


[n, k] = list(map(int, input().split()))
mat = list(map(int, input().split()))
x = list(map(lambda mat: 5 - mat, mat))
cnt = 0
for i in range(len(x)):
	if x[i] >= k:
		cnt = cnt + 1
print(int(cnt / 3))


(n, k) = map(int, input().split())
listans = [int(j) for j in input().split()]
counter = 0
team = 0
for i in range(len(listans)):
	if listans[i] + k <= 5:
		team += 1
	if team == 3:
		counter += 1
		team = 0
print(counter)


(s, n) = map(int, input().split())
l = list(map(int, input().split()))
l.sort(reverse=True)
c = 0
for i in l:
	if i + n <= 5:
		c += 1
print(c // 3)


import math
(n, k) = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
num_part = 0
for i in range(n):
	if y[i] + k <= 5:
		num_part += 1
print(math.floor(num_part / 3))


arr = [0] * 99
arr = list(map(int, input().split()))
n = arr[0]
k = arr[1]
cnt = 0
k = 5 - k
arr1 = [0] * n
arr1 = list(map(int, input().split()))
for i in range(0, n):
	if arr1[i] <= k:
		cnt += 1
print(int(cnt / 3))


(n, k) = map(int, input().split())
b = list(map(int, input().split()))
c = 0
for i in b:
	if not i + k > 5:
		c += 1
f = c // 3
print(f)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
count = 0
for i in range(len(a)):
	if a[i] + k > 5:
		pass
	else:
		count += 1
p = count // 3
print(p)


teams = 0
count = 0
(n, k) = map(int, input().split(' '))
times = map(int, input().split(' '))
for i in times:
	if i + k <= 5:
		count += 1
	if count == 3:
		count = 0
		teams += 1
print(teams)


import math
(n, k) = map(int, input().split(sep=' '))
y = list(map(int, input().split(sep=' ')))
l = 0
for i in range(n):
	if 5 - y[i] >= k:
		l = l + 1
print(l // 3)


(N, K) = [int(x) for x in input().split()]
L = [int(x) for x in input().split()]
L.sort()
X = []
for x in L:
	if 5 - x >= K:
		X.append(5 - x)
print(len(X) // 3)


def team(values, k):
	count = 0
	for i in range(len(values)):
		if values[i] + k <= 5:
			count = count + 1
	return count // 3
(n, k) = map(int, input().split())
values = list(map(int, input().split()))
print(team(values, k))


(n, k) = map(int, input().split())
students = list(map(int, input().split()))
times = 5 - k
num = 0
for i in range(n):
	if students[i] <= times:
		num += 1
print(int(num / 3))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
co = 0
mn = 5 - k
for i in l:
	if i <= mn:
		co += 1
print(co // 3)


(n, k) = [int(i) for i in input().split()]
players = [int(i) for i in input().split()]
team = []
for i in range(n):
	if players[i] + k <= 5:
		team.append(players[i])
if len(team) >= 3:
	print(len(team) // 3)
else:
	print(0)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
a = []
set = 0
for i in y:
	if i <= 5 - k:
		a.append(i)
		if len(a) % 3 == 0:
			set += 1
print(set)


(n, k) = map(int, input().split())
times = [1 if 5 - int(t) >= k else 0 for t in input().split()]
print(sum(times) // 3)


import sys
try:
	f = open('input.inpt')
	input = f.readline
except:
	input = sys.stdin.readline
(n, k) = list(map(int, input().strip().split()))
arr = list(map(int, input().strip().split()))
if n < 3:
	print(0)
else:
	arr.sort()
	i = 2
	ans = 0
	while i < n:
		if 5 - arr[i] >= k:
			ans += 1
		else:
			break
		i += 3
	print(ans)


input_s = input().split(' ')
n = int(input_s[0])
k = int(input_s[1])
input_l = input().split(' ')
i = 0
for l in input_l:
	l_int = int(l)
	if 5 - l_int >= k:
		i += 1
print(i // 3)


(n, k) = (int(x) for x in input().split())
n_valid_guys = len([None for x in input().split() if int(x) <= 5 - k])
print(n_valid_guys // 3)


(n, k) = map(int, input().split())
print(len([nm for nm in [int(x) for x in input().split()] if nm + k <= 5]) // 3)


(n, k) = map(int, input().split())
l = sorted(map(int, input().split()))
i = 0
while i < n:
	if l[i] > 5 - k:
		break
	i += 1
print(i // 3)


(n, k) = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
min_val = 5 - k
count = 0
for i in arr:
	if i <= min_val:
		count += 1
print(count // 3)


(n, y) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
cou = 0
for i in range(2, n, 3):
	if l[i] + y <= 5:
		cou += 1
print(cou)


(a, b) = map(int, input().split())
players = [int(i) for i in input().split() if int(i) + b <= 5]
print(len(players) // 3)


from bisect import bisect_right
max_participations = 5
(num_students, num_new_participations) = map(int, input().split())
limit_of_past_participations = max_participations - num_new_participations
num_participations_per_student = list(map(int, input().split()))
num_participations_per_student.sort()
num_valid_students = bisect_right(num_participations_per_student, limit_of_past_participations)
num_complete_teams = num_valid_students // 3
print(num_complete_teams)


from math import floor
(n, k) = map(int, input().split())
nbTimes = map(int, input().split())
allowed = [student for student in nbTimes if 5 - student >= k]
print(floor(len(allowed) / 3))


(players, years) = input().split(' ')
players = int(players)
years = int(years)
avail = []
player_year = input().split(' ')
for i in range(players):
	player_year[i] = int(player_year[i])
	if 5 - player_year[i] >= years:
		avail.append(player_year[i])
print(len(avail) // 3)


(n, k) = map(int, input().split())
y = sorted(map(int, input().split()))
sol = 0
for i in y:
	if k <= 5 - i:
		sol += 1
print(sol // 3)


(x, y) = map(int, input().split())
z = input().split()
i = 0
a = 0
b = 0
while i < x:
	a = int(z[i]) + y
	if a <= 5:
		b += 1
	i += 1
print(b // 3)


(n, k) = [int(i) for i in input().split()]
l = [int(j) for j in input().split()]
b = 0
for e in l:
	if e + k <= 5:
		b += 1
print(b // 3)


(n, k) = map(int, input().split())
sc = list(map(int, input().split()))
sc.sort()
c = 0
i = 0
while i <= n - 3:
	tot = []
	for j in range(i, i + 3):
		tot.append(sc[j])
	mx = max(tot)
	if mx + k <= 5:
		c += 1
		i += 3
	else:
		i += 1
print(c)


d = input()
d = d.split(' ')
k = d[1]
x = input()
x = x.split(' ')
z = 0
for i in x:
	if int(i) + int(k) <= 5:
		z += 1
print(int(z / 3))


inp = input()
chars = inp.split()
n = int(chars[0])
k = int(chars[1])
inp = input()
chars = inp.split()
people_left = 0
for i in range(n):
	x = int(chars[i])
	if x <= 5 - k:
		people_left = people_left + 1
print(int(people_left / 3))


a = input()
b = input()
a1 = a.split()
b1 = b.split()
c = 0
for i in b1:
	if int(i) + int(a1[1]) <= 5:
		c += 1
print(c // 3)


(n, k) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
nTm = 0
for i in l:
	if i + k <= 5:
		nTm += 1
print(nTm // 3)


(n, k) = map(int, input().split())
participantes = list((int(i) for i in input().split() if int(i) + k <= 5))
equipos = len(participantes) // 3
print(equipos)


(number, k) = map(int, input().split())
L = list(map(int, input().split()))
for i in range(k):
	for j in range(len(L)):
		L[j] += 1
L2 = []
L1 = []
for j in L:
	if j <= 5:
		L1.append(j)
		if len(L1) == 3:
			L2.append(L1)
			L1 = []
print(len(L2))


(N, K) = map(int, input().split())
Participants = list(map(int, input().split()))
Participants = sorted(Participants)
Teams = 0
for i in range(int(Participants.__len__() / 3)):
	Check = Participants[3 * i:3 * i + 3]
	if max(Check) + K <= 5:
		Teams += 1
print(Teams)


(n, k) = map(int, input().split())
a = input().split()
ans = 0
for e in range(len(a)):
	a[e] = int(a[e])
for each in a:
	if each + k <= 5:
		ans += 1
print(int(ans / 3))


(n, k) = map(int, input().split())
ll = list(map(int, input().split()))
t = 0
for i in ll:
	if i + k < 6:
		t += 1
print(t // 3)


import sys
import re

def main():
	n = k = 0
	students = []
	line_num = 1
	for line in sys.stdin:
		result = list(map(int, [x.strip() for x in line.split(' ')]))
		if line_num == 1:
			n = result[0]
			k = result[1]
			line_num += 1
		else:
			students = list(filter(lambda x: x + k <= 5, result))
			break
	if len(students) < 3:
		return 0
	return int(len(students) / 3)
print(main())


(n, k) = map(int, input().split())
sp = list(map(int, input().split()))
sp.sort()
if n / 3 < 1:
	print(0)
else:
	s = 0
	i = 0
	while i < n - 2:
		if max(sp[i] + k, sp[i + 1] + k, sp[i + 2] + k) <= 5:
			s += 1
			i += 3
		else:
			i += 1
	print(s)


(n, k) = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
c = 0
for i in range(2, len(x), 3):
	if x[i] + k < 6:
		c += 1
	else:
		break
print(c)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
y.sort()
teams = 0
if n < 3:
	print(teams)
else:
	for i in range(0, n - 2, 3):
		if i + 2 < n:
			if y[i] + k <= 5 and y[i + 1] + k <= 5 and (y[i + 2] + k <= 5):
				teams += 1
			else:
				break
	print(teams)


def teams(arr, k):
	ans = 0
	while True:
		x = []
		if len(arr) < 3:
			break
		x.append(arr.pop(0))
		x.append(arr.pop(0))
		x.append(arr.pop(0))
		flag = True
		for i in x:
			if i + k > 5:
				flag = False
				break
		if flag == True:
			ans += 1
		x.clear()
	return ans
x = list(map(int, input().rstrip().split()))
k = x[1]
n = list(map(int, input().rstrip().split()))
print(teams(sorted(n), k))


z = list(map(int, input().split()))
x = list(map(int, input().split()))
c = []
for i in x:
	if i + z[1] > 5:
		continue
	else:
		c.append(i)
if len(c) / 3 < 1:
	print(0)
	pass
else:
	print(int(len(c) / 3))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l = sorted(l, reverse=True)
a = len(l)
if all((i == 0 for i in l)):
	print(int(len(l) / 3))
else:
	for i in range(len(l)):
		if l[i] <= 5 - k:
			a = i
			break
	print(int((len(l) - a) / 3))


(size, team) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
total = 0
new_arr = []
pos = 0
i = 0
while i < size - 3 + 1:
	pos = 0
	if arr[i] + team <= 5:
		for j in range(i, i + 3):
			if arr[j] + team <= 5:
				pos += 1
			else:
				break
		if pos == 3:
			total += 1
			i = j + 1
		else:
			i += 1
	else:
		i += 1
print(total)


a = 0
(x, y) = map(int, input().split())
z = list(map(int, input().split()))
for h in range(x):
	if z[h] + y <= 5:
		a += 1
print(int(a / 3))


[n, k] = [int(x) for x in input().split(' ')]
l = [int(x) for x in input().split(' ')]
counter = 0
for i in l:
	if 5 - i >= k:
		counter += 1
print(counter // 3)


(n, k) = map(int, input().split())
lines = list(map(int, input().split()))
amt = 0
for x in lines:
	if x + k <= 5:
		amt += 1
print(int(amt / 3))


line = [int(i) for i in str(input()).split()]
values = [int(i) for i in str(input()).split()]
valids = [i for i in values if i <= 5 - line[1]]
print(len(valids) // 3)


tong = [0] * 6
(n, k) = map(int, input().split())
a = tuple(map(int, input().split()))
for i in a:
	tong[i] += 1
s = 0
for i in range(6 - k):
	s += tong[i]
print(s // 3)


s1 = input()
s2 = input()
a = []
b = []
a = s1.split(' ')
b = s2.split(' ')
temp = 0
t = 0
for i in range(0, len(b)):
	if int(b[i]) + int(a[1]) <= 5:
		temp += 1
	if temp == 3:
		t += 1
		temp = 0
print(t)


(n, k) = map(int, input().strip().split())
students = list(map(int, input().strip().split()))
students.sort()
while len(students) > 0:
	if max(students) + k > 5:
		students.remove(max(students))
	else:
		break
print(len(students) // 3)


(n, k) = map(int, input().split())
y = tuple(map(int, input().split()))
r = 0
for i in range(n):
	if y[i] + k <= 5:
		r += 1
print(r // 3)


(n, k) = [int(i) for i in input().split()]
m = [int(i) for i in input().split()]
print(sum((1 if i <= 5 - k else 0 for i in m)) // 3)


(n, k) = input().split()
n = int(n)
k = int(k)
ok = 0
members = [int(i) for i in input().split()]
for i in range(n):
	if members[i] <= 5 - k:
		ok += 1
print(int(ok / 3))


(n, k) = map(int, input().split())
list_ = list(map(int, input().split()))
list_.sort()
ans = 0
temp = 0
temp1 = []
for j in range(n):
	temp1.append(list_[j] + k)
for i in range(n):
	if temp1[i] <= 5:
		temp += 1
	else:
		temp += 0
print(temp // 3)


(n, k) = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
res = [5 - i for i in a]
res1 = list(filter(lambda x: x >= k, res))
print(len(res1) // 3)


(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
count = 0
i = 0
while i < len(arr):
	arr[i] += k
	if arr[i] > 5:
		x = i
		break
	else:
		count += 1
	i += 1
if i == 0:
	print('0')
else:
	print(count // 3)


z = list(map(int, input().split()))
y = list(map(int, input().split()))
y.sort()
count = 0
for i in range(z[0]):
	if y[i] <= 5 - z[1]:
		count += 1
	else:
		break
print(count // 3)


input_1 = input()
input_1 = input_1.split()
n = int(input_1[0])
k = int(input_1[1])
y = input()
y = y.split()
y = [int(x) for x in y]
y.sort()
b = []
for x in y:
	if x != 5:
		b.append(x)
a = int(len(b) / 3)
my_list = []
temp_list = []
n = 0
for x in range(a):
	for z in range(3):
		temp_list.append(b[n] + k)
		n = n + 1
	my_list.append(temp_list)
	temp_list = []
for x in my_list:
	for q in range(3):
		if x[q] > 5:
			a = a - 1
			break
print(a)


teamCounter = 0
ans = 0
(numberOfMembers, times) = list(map(int, input().split()))
members = list(map(int, input().split()))
members.sort()
for i in members:
	if i + times <= 5:
		teamCounter += 1
	if teamCounter == 3:
		ans += 1
		teamCounter = 0
print(ans)


(n, k) = map(int, input().split())
ys = filter(lambda y: y <= 5 - k, map(int, input().split()))
print(len(list(ys)) // 3)


import sys
import math
import bisect

def solve(A, k):
	cnt = 0
	for a in A:
		if 5 - a >= k:
			cnt += 1
	return cnt // 3

def main():
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	ans = solve(A, k)
	print(ans)
main()


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
counter = 0
for i in range(len(s)):
	if abs(s[i] - 5) >= k:
		counter += 1
if counter >= 3:
	print(int(counter / 3))
else:
	print('0')


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
(c, d) = ([], [])
for x in l:
	c.append(x + b)
for x in c:
	if x <= 5:
		d.append(x)
print(len(d) // 3)


import sys
import math
import heapq
from collections import defaultdict, deque
input = sys.stdin.readline

def r():
	return int(input())

def rm():
	return map(int, input().split())

def rl():
	return list(map(int, input().split()))
a = [0] * 6
(n, k) = rm()
b = rl()
for i in b:
	a[i] += 1
print(sum(a[:-k]) // 3)


(x, y) = map(int, input().split())
a = sorted(list(map(int, input().split())))
a = [a[i - 3:i] for i in range(3, x + 1, 3)]
print(sum(list(map(lambda x: 1 if x[0] <= 5 - y and x[1] <= 5 - y and (x[2] <= 5 - y) else 0, a))))


from math import factorial as f
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr = list(filter(lambda x: x <= 5 - k, arr))
n = len(arr)
print(n // 3)


(a, b) = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
e = 0
for i in range(0, len(c)):
	if 5 - c[i] >= b:
		e = e + 1
print(e // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
c = 0
l = [x + k for x in l]
for x in l:
	if x <= 5:
		c += 1
print(int(c / 3))


(N, Q) = map(int, input().split())
Y = list(map(int, input().split()))
Team = []
for a in range(N):
	if Y[a] <= 5 - Q:
		Team.append(Y[a])
print(len(Team) // 3)


(n, k) = map(int, input().split())
x = input('').split()
list = []
for c in range(n):
	if int(x[c]) + k > 5:
		pass
	else:
		list.append(int(x[c]))
print(int(len(list) / 3))


def main():
	(x, y) = map(int, input().split())
	students = [int(i) for i in input().split()]
	count = 0
	for i in range(x):
		if students[i] + y <= 5:
			count += 1
	print(count // 3)
main()


(n, k) = map(int, input().split())
arr = [int(x) for x in input().split()]
cnt = 0
for i in arr:
	if 5 - i >= k:
		cnt += 1
print(str(cnt // 3))


(n, k) = map(int, input().split())
data = [int(i) for i in input().split() if i <= str(5 - k)]
print(len(data) // 3)


R = lambda : list(map(int, input().split()))
(n, k) = R()
y = R()
x = 0
for a in y:
	if a <= 5 - k:
		x += 1
print(x // 3)


(a, b) = map(int, input().split())
z = list(map(int, input().split()))
z.sort()
v = []
for i in z:
	if i + b <= 5:
		v.append(i)
	else:
		break
print(len(v) // 3)


(a, b) = map(int, input().split())
c = list(map(int, input().split()))
d = []
for i in c:
	if abs(i - 5) >= b:
		d.append(i)
print(len(d) // 3)


(length, times) = list(map(int, input().split()))
ppl = list(map(int, input().split()))
ppl_filter = list(filter(lambda x: x + times <= 5, ppl))
print(len(ppl_filter) // 3)


a = input()
b = input()
a1 = a.split()
b1 = b.split()
n = int(a1[0])
k = int(a1[1])
l = 5 - k
ans = 0
for i in b1:
	if int(i) <= l:
		ans += 1
print(int(ans / 3))


n = input()
lst = list(map(int, n.split()))
k = lst[1]
m = input()
main = list(map(int, m.split()))
count = 0
for i in main:
	val = i + k
	if val <= 5:
		count += 1
print(count // 3)


import math
(a, b) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = []
n = 5 - b
for i in l1:
	if i <= n:
		l2.append(i)
le = len(l2)
print(math.floor(le / 3))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
d = 5 - k
par = []
import math
for x in l:
	if x <= d:
		par.append(x)
s = len(par)
f = math.floor(s / 3)
print(f)


y = input().split()
x = input().split()
k = 5 - int(y[1])
su = 0
for i in x:
	if k >= int(i):
		su += 1
print(su // 3)


(n, k) = map(int, input().split())
l = sorted(list(map(int, input().split())))
p = 5 - k
o = 0
for i in range(len(l)):
	if l[i] > p:
		p = i
		o = 1
		break
if o == 0:
	print(len(l) // 3)
else:
	print(p // 3)


(n, k) = map(int, input().split())
m = [int(x) for x in input().split()]
s = 0
for i in range(0, n):
	if m[i] + k <= 5:
		s += 1
print(int(s / 3))


l = list(input().split())
n = int(l[0])
k = int(l[1])
q = list(input().split())
q = [int(i) for i in q]
summation = 0
for i in q:
	if 5 - i >= k:
		summation += 1
print(summation // 3)


(n, k) = map(int, input().split())
s = 0
res = 0
mat = [int(a) for a in input().split()]
mat.sort()
for i in range(n):
	mat[i] = mat[i] + k
	if mat[i] > 5:
		break
	else:
		s = s + 1
		if s == 3:
			res = res + 1
			s = 0
print(res)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
count = 0
for a in A:
	if a + K <= 5:
		count += 1
print(count // 3)


(m, n) = map(int, input().split())
l1 = list(map(int, input().split()))
c = 0
for i in range(m):
	if l1[i] + n <= 5:
		c += 1
print(c // 3)


a = input()
b = a.split()
c = input()
d = c.split()
f = []
for i in d:
	f.append(int(i))
count = 0
for el in f:
	if 5 - el >= int(b[1]):
		count += 1
print(count // 3)


(n, k) = list(map(lambda x: int(x), input().split()))
times = list(map(lambda x: int(x), input().split()))
m = 5 - k
members = list(filter(lambda x: x <= m, times))
print(len(members) // 3)


from typing import List, Tuple

def parse_input() -> Tuple[int, int, List[int]]:
	(n, k) = [int(x) for x in input().split()]
	y = [int(x) for x in input().split()]
	return (n, k, y)

def solve(n: int, k: int, y: List[int]) -> int:
	y.sort()
	count = 0
	for x in range(0, n, 3):
		group = y[x:x + 3]
		if len(group) == 3 and k <= 5 - group[-1]:
			count += 1
	return count
(n, k, y) = parse_input()
print(solve(n, k, y))


(n, k) = map(int, input().split())
nums = [int(s) for s in input().split()]
limit = 5 - k
total = sum((x <= limit for x in nums)) // 3
print(total)


(n, k) = map(int, input().split())
nums = list(map(int, input().split()))
dic = dict()
teams = 0
for i in nums:
	if i + k <= 5:
		teams += 1
if teams < 3:
	print(0)
else:
	print(teams // 3)


def teams_possible(arr, k):
	ans = 0
	for i in arr:
		if i + k <= 5:
			ans += 1
	return ans // 3
(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
print(teams_possible(arr, k))


n = input()
(n, k) = n.split(' ')
n = int(n)
k = int(k)
temp = input()
arr = temp.split(' ')
for i in range(n):
	arr[i] = int(arr[i]) + k
arr.sort()
iCount = 0
count = 0
for i in range(n):
	if arr[i] > 5:
		break
	else:
		iCount += 1
		if iCount == 3:
			count += 1
			iCount = 0
print(count)


(a, b) = map(int, input().split())
lis = list(map(int, input().split()))
lis.sort()
for i in range(len(lis)):
	lis[i] = lis[i] + b
co = 0
for i in range(a):
	if lis[i] <= 5:
		co += 1
print(co // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
count = 0
for i in range(0, n):
	if k + l[i] <= 5:
		count += 1
if count % 3 == 0:
	print(int(count / 3))
else:
	x = count - count % 3
	print(int(x / 3))


nk = input().split(' ')
k = int(nk[1])
count = 0
lim = 5 - k
ln = input().split(' ')
for num in ln:
	if int(num) <= lim:
		count += 1
print(count // 3)


(n, k) = input().split()
(n, k) = (int(n), int(k))
y = input().split()
ans = 0
for i in range(n):
	y[i] = int(y[i])
	if y[i] <= 5 - k:
		ans += 1
print(ans // 3)


(n, k) = map(int, input().split())
ans = 0
if k == 1:
	for i in list(map(int, input().split())):
		if i <= 4:
			ans += 1
elif k == 2:
	for i in list(map(int, input().split())):
		if i <= 3:
			ans += 1
elif k == 3:
	for i in list(map(int, input().split())):
		if i <= 2:
			ans += 1
elif k == 4:
	for i in list(map(int, input().split())):
		if i <= 1:
			ans += 1
elif k == 5:
	for i in list(map(int, input().split())):
		if i <= 0:
			ans += 1
print(ans // 3)


(n, k) = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
h = [e + k for e in h if e + k <= 5]
print(len(h) // 3)


(n, k) = [int(x) for x in input().split()]
pros = [int(x) for x in input().split()]
teams = 0
for i in range(n):
	z = pros[i] + k
	if z <= 5:
		teams += 1
print(int(teams / 3))


(n, k) = map(int, input().split())
pupils = list(map(int, input().split()))
count = 0
limit_times = 5 - k
for i in pupils:
	if i <= limit_times:
		count += 1
print(count // 3)


x = input()
y = input()
this = x.split()
list = y.split()
i = 0
count = 0
while i < len(list):
	n = int(list[i]) + int(this[1])
	if n <= 5:
		count += 1
	i += 1
a = count % 3
b = int((count - a) / 3)
print(b)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
(N, K) = map(int, input().split())
A = [int(x) for x in input().split()]
A = [x for x in A if 5 - x >= K]
print(len(A) // 3)


import sys
f = sys.stdin
(n, k) = list(map(int, f.readline().strip().split()))
A = [int(u) for u in f.readline().strip().split()]
m = 0
for u in A:
	if u + k <= 5:
		m += 1
print(m // 3)


team = []
(n, k) = input().split()
li = [int(i) for i in input().split()]
for j in range(int(n)):
	if 5 - li[j] >= int(k):
		team.append(li[j])
if len(team) < 3:
	print(0)
else:
	x = len(team) // 3
	print(x)


n = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
l1 = []
for i in range(0, len(x)):
	x[i] = 5 - x[i]
	if x[i] >= n[1]:
		l1.append(x[i])
print(int(len(l1) / 3))


(x, y) = [int(a) for a in input().split()]
z = [int(a) for a in input().split()]
a = 0
for i in z:
	if i + y <= 5:
		a += 1
print(int(a / 3))


(n, k) = map(int, input().split())
l = [int(i) if int(i) <= 5 - k else -1 for i in input().split()]
d = n - l.count(-1)
print(d // 3)


(n, k) = map(int, input().split())
l = []
l = list(map(int, input().split()))
l.sort()
start = 0
end = 2
team = 0
for i in range(0, n):
	if start >= n or end >= n:
		break
	elif l[end] + k <= 5:
		team += 1
		start += 3
		end += 3
	else:
		start += 3
		end += 3
print(team)


(n, k) = map(int, input().split())
L = list(map(int, input().split()))
L.sort()
i = 0
while i < n and L[i] <= 5 - k:
	i += 1
print(i // 3)


from sys import stdin
(n, k) = map(int, stdin.readline().rstrip().split(' '))
nums = list(map(int, stdin.readline().rstrip().split(' ')))
lim = 5 - k
tot = 0
for num in nums:
	if num <= lim:
		tot += 1
print(tot // 3)


def change(a):
	return 1 if a + k <= 5 else 0
(n, k) = map(int, input().split())
y = list(map(int, input().split()))
y = list(map(change, y))
print(sum(y) // 3)


(n, k) = map(int, input().split())
b = list(map(int, input().split()))
total = 0
for i in range(n):
	if b[i] + k <= 5:
		total += 1
print(int(total / 3))


(n, k) = list(map(int, input().split()))
s = 0
t = list(map(int, input().split()))
t.sort()
for i in range(n):
	if t[i] + k <= 5:
		s += 1
	elif t[i] + k > 5:
		break
print(s // 3)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
y = [int(x) for x in input().split(' ')]
teams = 0
st = []
for x in y:
	if 5 - x >= k:
		st.append(x)
teams = len(st) // 3
print(teams)


(n, k) = map(int, input().split())
involvement = list(map(int, input().split()))
progers = 0
for p in involvement:
	if p + k <= 5:
		progers += 1
print(progers // 3)


import sys
(n, k) = map(int, sys.stdin.readline().split())
nums = list(map(int, sys.stdin.readline().split()))
cnt = 0
for i in range(n):
	nums[i] += k
for j in nums:
	if j <= 5:
		cnt += 1
print(cnt // 3)


(n, k) = map(int, input().split(' '))
arr = [int(i) for i in input().split(' ')]
res = 0
for i in arr:
	if i + k < 6:
		res += 1
print(res // 3)


lst1 = list(map(int, input().split()))
lst2 = list(map(int, input().split()))
k = lst1[1]
i = 0
while i < len(lst2):
	lst2[i] = lst2[i] + k
	i = i + 1
count = 0
i = 0
while i < len(lst2):
	x = 0
	if int(lst2[i]) <= 5:
		count = count + 1
	i = i + 1
k = int(count / 3)
print(k)


n = list(map(int, input().split()))
n1 = list(map(int, input().split()[:n[0]]))
lst = []
lst1 = []
b = 0
for i in range(len(n1)):
	v = 5 - n1[i]
	if v >= n[1]:
		if b != 3:
			lst.append(n1[i])
			b = b + 1
		else:
			lst1.append(lst)
			lst = []
			b = 0
			lst.append(n1[i])
			b = b + 1
if lst != [] and len(lst) == 3:
	lst1.append(lst)
print(len(lst1))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
while len(a) > 0 and 5 - max(a) < k:
	a.remove(max(a))
x = int(len(a) / 3)
print(x)


def solve(a, b, arr):
	c = 0
	for i in range(a):
		arr[i] += b
	for i in range(a):
		if arr[i] <= 5:
			c += 1
	return int(c / 3)
(a, b) = [int(j) for j in input().split(' ')]
arr = list(map(int, input().split(' ')))
print(solve(a, b, arr))


import sys
(n, k) = map(int, sys.stdin.readline().split())
y = list(map(int, sys.stdin.readline().split()))
y2 = [i for i in y if i <= 5 - k]
print(len(y2) // 3)


(n, k) = [int(i) for i in input().split()]
m = 5 - k
l = [int(i) for i in input().split()]
p = 0
for i in range(n):
	if l[i] <= m:
		p += 1
print(p // 3)


(n, k) = list(map(int, input().split()))
li = map(int, input().split())
for i in range(k):
	li = filter(lambda x: x < 5, li)
	li = map(lambda x: x + 1, li)
print(len(list(li)) // 3)


import math

def ost(a, b):
	if a % b != 0:
		return 1
	return 0
(n, m) = map(int, input().split())
data = list(map(int, input().split()))
cnt = 0
for i in range(n):
	if data[i] <= 5 - m:
		cnt += 1
print(cnt // 3)


(n, k) = [int(i) for i in input().split()]
studs = [int(i) for i in input().split()]
studs.sort()
res = 0
count = 0
for e in studs:
	if e + k <= 5:
		count += 1
		if count == 3:
			res += 1
			count = 0
print(str(res))


def teams(k, array):
	array_2 = []
	for i in range(len(array)):
		if array[i] + k <= 5:
			array_2.append(array[i] + k)
	teams = len(array_2) // 3
	print(teams)
(n, k) = input().split()
array = [int(x) for x in input().split()]
teams(int(k), array)


(n, k) = [int(x) for x in input().split()]
people = [int(x) for x in input().split()]
people.sort()
count = 0
for i in range(2, len(people), 3):
	if 5 - people[i - 2] >= k and 5 - people[i - 1] >= k and (5 - people[i] >= k):
		count += 1
print(count)


import math
(n, k) = input().split()
(n, k) = (int(n), int(k))
ar = input().split(' ')
ar = sorted([5 - int(i) for i in ar])
num_player = 0
for i in range(n):
	if ar[i] >= k:
		num_player = n - i
		break
print(math.floor(num_player / 3))


(n, k) = map(int, input().split())
A = [int(x) for x in input().split()]
num = 0
for i in range(6 - k):
	num += A.count(i)
print(num // 3)


(n, k) = map(int, input().split())
s = input()
f = [int(s) for s in s.split()]
h = sorted(f)
z = []
for i in range(n):
	if h[i] <= 5 - k:
		z.append(h[i])
print(len(z) // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
y.sort()
d = 5 - k
candidates = [x for x in y if x <= d]
print(len(candidates) // 3)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
l1 = []
c = 0
d = int(n / 3)
l1 = input().split(' ')
l1.sort()
l1 = [int(p) for p in l1]
for i in range(0, 3 * d, 3):
	if 5 - l1[i] >= k and 5 - l1[i + 1] >= k and (5 - l1[i + 2] >= k):
		c = c + 1
print(c)


(memeber, k) = map(int, input().split())
arr = list(map(int, input().split()))
erase = list(filter(lambda x: x < 5 - k + 1, arr))
print(len(erase) // 3)


(n, k) = map(int, input().split())
a = sorted(list(map(int, input().split())))
i = 0
while i < n and a[i] <= 5 - k:
	i += 1
print(i // 3)


import math
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
approved = [element for element in l if element < 5 - k + 1]
if len(approved) < 3:
	print(0)
else:
	print(len(approved) // 3)


import sys
import math
a = list(map(int, input().split(' ')))
l = list(map(int, input().split(' ')))
g = 0
for i in range(a[0]):
	if 5 - l[i] >= a[1]:
		g += 1
print(g // 3)


import math
import sys
import collections

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))
(n, k) = mi()
print(len([x for x in li() if k <= 5 - x]) // 3)


a = list(map(int, input().split()))
n = int(a[0])
k = int(a[1])
y = [0] * n
temp = 0
c = 0
y = list(map(int, input().split()))
for i in range(n):
	for j in range(i, n):
		if y[i] > y[j]:
			temp = y[i]
			y[i] = y[j]
			y[j] = temp
for i in range(0, n - 2, 3):
	j = 0
	p = y[i]
	q = y[i + 1]
	r = y[i + 2]
	while j < k and p < 5 and (q < 5) and (r < 5):
		p = p + 1
		q = q + 1
		r = r + 1
		j = j + 1
	if j == k:
		c = c + 1
print(c)


n = list(map(int, input().split()))
a = list(map(int, input().split()))
d = 0
for i in range(n[0]):
	if a[i] <= 5 - n[1]:
		d += 1
if d < 3:
	print(0)
else:
	print(d // 3)


(people, times) = map(int, input().split())
data = [int(i) for i in input().split()]
data.sort(reverse=True)
pos = people + 1
for i in range(len(data)):
	if data[i] + times <= 5:
		pos = people - i
		break
if pos == people + 1:
	print(0)
else:
	print(pos // 3)


(n, k) = map(int, input().split())
acm = list(map(int, input().split()))
s = n - k
cnt = 0
team = 0
for i in acm:
	if i <= 5 - k:
		cnt = cnt + 1
	if cnt == 3:
		team = team + 1
		cnt = 0
print(team)


istr = input()
raw = istr.split()
n = int(raw[0])
k = int(raw[1])
numstr = input()
numstrlst = numstr.split()
numlst = list()
for i in numstrlst:
	numlst.append(5 - int(i))
numlst.sort(reverse=True)
count = -1
max = 0
for x in range(n):
	count = count + 3
	if count < n:
		if numlst[count] >= k:
			max = max + 1
	elif count >= n:
		break
print(max)


(N, K) = list(map(int, input().split()))
print(len(list(filter(lambda x: 5 - x >= K, list(map(int, input().split()))))) // 3)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
require = 5 - k
i = 0
count = 0
while arr[i] <= require and i < n:
	if i < n - 1:
		count += 1
		i += 1
	elif i == n - 1 and arr[i] <= require:
		count += 1
		break
print(count // 3)


(n, k) = map(int, input().split())
y = sum(map(lambda x: 1 if 5 - k >= int(x) else 0, input().split()))
print(y // 3)


(n, k) = [int(x) for x in input().split()]
print(len(list(filter(lambda x: 5 - int(x) >= k, input().split()))) // 3)


(n, k) = input().split()
n = int(n)
k = int(k)
students = input().split()
critical = 5 - k
valid_students = 0
for i in range(n):
	if int(students[i]) <= critical:
		valid_students += 1
valid_teams = valid_students // 3
print(valid_teams)


(n, k) = input().split()
n = int(n)
k = int(k)
ls = [int(x) for x in input().split()]
js = []
for i in range(0, n):
	if ls[i] <= 5 - k:
		js.append(ls[i])
a = int(len(js) / 3)
print(a)


l = [int(x) for x in input().split(' ')]
n = l[0]
k = l[1]
l1 = [int(x) for x in input().split(' ')]
count = 0
for i in l1:
	if i + k <= 5:
		count = count + 1
print(count // 3)


(jumlah, mau) = map(int, input().split())
x = list(map(int, input().split()))
total = 0
for z in range(jumlah):
	if x[z] + mau <= 5:
		total += 1
print(int(total / 3))


word = str(input())
word = word.split(' ')
part = int(word[0])
times = int(word[1])
thing = str(input())
thing = thing.split(' ')
eli = 0
for n in range(part):
	thing[n] = int(thing[n]) + times
	if thing[n] < 6:
		eli += 1
print(int(eli / 3))


cin_p = int(input().split(' ')[1])
cin_kol = input().split(' ')
k = 5
if len(cin_kol) >= 3:
	while k > 5 - cin_p:
		while (str(k) in cin_kol) == True:
			cin_kol.remove(str(k))
		k -= 1
final = int(len(cin_kol) / 3)
print(final)


P = lambda : map(int, input().split())
(n, k) = P()
print(sum((x <= 5 - k for x in P())) // 3)


(n, k) = map(int, input().split())
x = list(map(int, input().split()))
g = 0
for v in x:
	if v + k < 6:
		g += 1
print(g // 3)


from sys import stdin
_input = stdin.readline
(_int, _range) = (int, range)

def solution():
	(n, k) = [_int(i) for i in _input().split()]
	arr = [_int(i) for i in _input().split()]
	arr.sort()
	ans = 0
	for i in _range(2, n, 3):
		if arr[i] + k <= 5:
			ans += 1
	print(ans)
solution()


(n, k) = [int(i) for i in input().split()]
line = [int(i) for i in input().split()]
line = sorted(line)
new = []
for i in line:
	if i <= 5 - k:
		new.append(i)
if len(new) < 3:
	print('0')
else:
	print(len(new) // 3)


import math
n = list(map(int, input().split(' ')))
x = list(map(int, input().split(' ')))
ans = []
for i in range(n[0]):
	x[i] = 5 - x[i]
	if x[i] >= n[1]:
		ans.append(x[i])
print(math.floor(len(ans) / 3))


x = input()
x = x.split()
y = input()
y = y.split()
for i in range(len(x)):
	x[i] = int(x[i])
student = 0
for i in range(x[0]):
	y[i] = int(y[i]) + x[1]
	if y[i] <= 5:
		student = student + 1
print(int(student / 3))


n = list(map(int, input().split()))
y = list(map(int, input().split()))
y_sorted = sorted(y)
team = n[0] // 3
count = 0
d = 2
while team > 0:
	if 5 - y_sorted[d] >= n[1]:
		count += 1
	else:
		break
	team -= 1
	d += 3
print(count)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
for i in range(len(arr)):
	arr[i] = arr[i] + k
save = []
for i in range(len(arr)):
	if arr[i] <= 5:
		save.append(arr[i])
store = int(len(save) / 3)
print(store)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
(n, k) = invr()
s = inlt()
cnt = 0
for i in s:
	if i + k <= 5:
		cnt += 1
print(cnt // 3)


cnt = 0
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
i = 0
while i < n:
	if 5 - arr[i] >= k:
		cnt += 1
	i += 1
print(cnt // 3)


(n, k) = map(int, input().split())
y = map(int, input().split())
z = sorted(y)
k = 5 - k
if k < 0:
	print('0')
else:
	count = 0
	for i in z:
		if i <= k:
			count = count + 1
print(int(count / 3))


(n, k) = list(map(int, input().rstrip().split()))
l = list(map(int, input().rstrip().split()))
l = [x for x in l if x < 6 - k]
print(len(l) // 3)


from sys import stdin, stdout
(N, k) = map(int, stdin.readline().split())
arr = list(map(int, stdin.readline().split()))
count = 0
for i in range(len(arr)):
	if arr[i] + k <= 5:
		count += 1
print(count // 3)


(n, k) = tuple(map(int, input().strip(' ').split(' ')))
arr = list(map(int, input().strip(' ').split(' ')))
teams = set()
for i in range(len(arr)):
	if 5 - arr[i] >= k:
		teams.add(i)
print(len(teams) // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
ans = 0
for u in y:
	if u <= 5 - k:
		ans += 1
print(ans // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
if n < 3:
	print(0)
else:
	l.sort()
	t = n - n % 3
	l = l[:t]
	count = 0
	for i in range(0, len(l), 3):
		t = l[i:i + 3]
		m = max(t)
		if m + k <= 5:
			count += 1
	print(count)


(n, k) = [int(x) for x in input().split()]
l = [int(y) for y in input().split()]
l = sorted(l)
s = []
for i in l:
	if i <= 5 - k:
		s.append(i)
print(len(s) // 3)


(n, k) = map(int, input().split())
people = list(map(int, input().split()))
cant = []
for i in range(n):
	if people[i] > 5 - k:
		cant.append(people[i])
available = [i for i in people if i not in cant]
teams = int(len(available) / 3)
print(teams)


(totalPeople, noOfTimes) = map(int, input().split())
peopleValueList = list(map(int, input().split()))[:totalPeople]
totalTeams = 0
tempVal = 0
for a in peopleValueList:
	if a + noOfTimes <= 5:
		tempVal = tempVal + 1
	if tempVal == 3:
		totalTeams = totalTeams + 1
		tempVal = 0
print(totalTeams)


m = lambda : map(int, input().split())
(n, k) = m()
print(sum((i <= 5 - k for i in m())) // 3)


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
b = []
count = 0
for i in range(n):
	b.append(5 - a[i])
	if b[i] >= k:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
p = [5 - i >= k for i in l]
print(sum(p) // 3)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
team = 0
for i in range(2, len(a), 3):
	if 5 - a[i] >= m:
		team += 1
print(team)


import math
(n, k) = map(int, input().split())
y = list(map(int, input().split()))
schet = 0
for i in range(n):
	if y[i] + k <= 5:
		schet += 1
schet = math.floor(schet / 3)
print(schet)


def inp():
	return map(int, input().split())

def arr_inp():
	return [int(x) for x in input().split()]
(n, k) = inp()
y = arr_inp()
y.sort()
count = 0
for i in range(n // 3):
	if max(y[i * 3:(i + 1) * 3]) + k <= 5:
		count += 1
	else:
		break
print(count)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
total = 5
ans = 0
atMost = total - k
count = 0
for i in range(0, n):
	if arr[i] <= atMost:
		count += 1
ans = count // 3
print(ans)


(n, k) = map(int, input().split())
ps = 0
for p in list(map(int, input().split())):
	if p <= 5 - k:
		ps += 1
print(ps // 3)


import math, os, sys
import string, re
import itertools, functools, operator
from collections import Counter

def inputint():
	return int(input())

def inputarray(func=int):
	return map(func, input().split())
(a, k) = inputarray()
print(len(list(filter(lambda x: int(x) <= 5 - k, input().split()))) // 3)


(n, k) = [int(x) for x in input().split()]
num = list(map(int, input().split()))
k = 5 - k
lat = []
for i in range(n):
	if num[i] <= k:
		lat.append(num[i])
s = len(lat)
print(int(s / 3))


n = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a = sorted(a)
count = 0
x = 5 - n[1]
if x < 0:
	print(0)
else:
	for i in range(len(a)):
		if a[i] <= x:
			count = count + 1
	print(count // 3)


nk = input().split(' ')
n = int(nk[0])
k = int(nk[1])
if n < 3:
	print(0)
else:
	y_k = []
	y_ksort = []
	y_kstr = input().split(' ')
	for s in y_kstr:
		y_k.append(int(s))
		y_ksort.append(int(s))
	y_ksort.sort()
	if y_ksort[0] + k > 5:
		print(0)
	else:
		count = 0
		for y in y_ksort:
			if y + k <= 5:
				count += 1
			else:
				break
		print(count // 3)


(n, k) = map(int, input().split())
print(sorted([*map(int, input().split())] + [6 - k]).index(6 - k) // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
mylist = [i for i in y if i <= 5 - k]
out = len(mylist) // 3
print(out)


from sys import stdin, stdout
(n, k) = map(int, stdin.readline().split())
person = list(map(int, stdin.readline().split()))
cnt = sum((1 for y in person if y <= 5 - k))
print(cnt // 3)


(n, k) = map(int, input().split())
times = list(map(int, input().split()))
times = [i for i in times if i < 5]
solution = 0
if len(times) >= 3:
	times = [i + k for i in times]
	times = [i for i in times if i <= 5]
	solution = len(times) // 3
print(solution)


(n, k) = map(int, input().split())
a = map(int, input().split())
print(sum((1 for i in a if i + k <= 5)) // 3)


line = input()
(a, b) = line.split()
n = int(a)
k = int(b)
list1 = [int(i) for i in input().split()]
p = 5 - k
list2 = []
for i in range(0, n, 1):
	if list1[i] <= p:
		list2.append(list1[i])
print(len(list2) // 3)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
s = 0
for f in range(len(y)):
	if y[f] + k <= 5:
		s += 1
print(int(s // 3))


(n, k) = map(int, input().split())
list1 = list(map(int, input().split()))
p = []
for item in list1:
	if item + k <= 5:
		p.append(item)
print(len(p) // 3)


(n, k) = map(int, input().split(' '))
d = input().split(' ')
l = []
for i in d:
	if int(i) + k > 5:
		continue
	else:
		l.append(i)
if l != [] and len(l) >= 3:
	print(int(len(l) / 3.0))
else:
	print('0')


(n, k) = map(int, input().split())
lis = list(map(int, input().split()))
lis = [item + k for item in lis]
count = 0
for item in lis:
	if item <= 5:
		count += 1
print(count // 3)


(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
count = 0
lst = [5 - i for i in lst]
gst = []
for i in range(len(lst)):
	if lst[i] >= k:
		gst.append(lst[i])
print(len(gst) // 3)


(n, k) = input().split()
arr = input().split()
for i in range(0, len(arr)):
	arr[i] = int(arr[i]) + int(k)
arr.sort()
total = 0
for i in arr:
	if 0 <= i <= 5:
		total += 1
print(total // 3)


from sys import stdin
(n, k) = [int(i) for i in stdin.readline().split()]
A = [int(i) for i in stdin.readline().split()]
A.sort()
teams = 0
T = []
for i in A:
	T.append(i)
	if len(T) == 3:
		if T[-1] + k > 5:
			break
		else:
			teams += 1
			T = []
print(teams)


TN = 1

def solution():
	(n, k) = map(int, input().split())
	y = list(map(int, input().split()))
	kl = 0
	for i in range(n):
		if y[i] <= 5 - k:
			kl += 1
	print(kl // 3)
while TN != 0:
	solution()
	TN -= 1


(n, k) = [int(x) for x in input().split()]
s = [int(x) for x in input().split()]
p = []
for x in s:
	if x <= 5 - k:
		p.append(x)
print(len(p) // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l1 = []
for i in l:
	if i + k > 5:
		continue
	else:
		l1.append(i)
print(len(l1) // 3)


(m, n) = [int(i) for i in input().split()]
c = 5 - n
a = [int(i) for i in input().split() if int(i) <= c]
print(len(a) // 3)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
count = 0
arr.sort()
cnt = 0
for x in arr:
	if x + (k - 1) < 5:
		count += 1
	if count == 3:
		cnt += 1
		count = 0
print(cnt)


line = input().split()
n = int(line[0])
k = int(line[1])
s = [int(a) for a in input().split()]
st = []
for i in s:
	if i <= 5 - k:
		st.append(i)
	else:
		pass
cnt = len(st) // 3
print(cnt)


(n, k) = map(int, input().split())
y = list(map(int, input().split()))
y.sort()
i = 0
for j in range(2, n, 3):
	if 5 - y[j] >= k:
		i += 1
print(i)


(n, k) = map(int, input().split())
j = input().split()
count = 0
for l in j:
	l = int(l)
	if l + k <= 5:
		count = count + 1
ans = count // 3
print(ans)


(N, K) = map(int, input().split())
L = list(map(int, input().split()))
count = 0
for i in range(N):
	L[i] = 5 - L[i]
	if L[i] >= K:
		count += 1
print(int(count / 3))


(n, k) = map(int, input().split())
y = list((int(_) for _ in input().split()))
for i in range(n):
	y[i] = 5 - y[i]
y = list(sorted(y, reverse=True))
p_num = 0
for i in y:
	if i >= k:
		p_num += 1
	else:
		break
print(p_num // 3)


(n, k) = map(int, input().split())
y = map(int, input().split())
y = sorted(y, reverse=False)
teams = 0
current = 0
for person in y:
	if person + k <= 5:
		current = current + 1
	if current == 3:
		teams = teams + 1
		current = 0
print(teams)


(n, k) = map(int, input().split())
cs = 0
sl = list(map(int, input().split()))
for i in sl:
	if i + k <= 5:
		cs += 1
print(cs // 3)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
res = 0
for x in range(2, n, 3):
	res += a[x] + m <= 5
print(res)


N = list(map(int, input().split(' ')))
n = N[0]
k = N[1]
a = list(map(int, input().split(' ')))
i = 0
t = 0
c = 0
while i < n:
	if a[i] + k <= 5:
		c = c + 1
	if c == 3:
		t = t + 1
		c = 0
	i = i + 1
print(t)


(m, n) = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
for i in range(m):
	arr[i] += n
res = count = 0
for i in arr:
	if i < 6:
		count += 1
	else:
		break
	if count == 3:
		res += 1
		count = 0
print(res)


(n, k) = map(int, input().split(' '))
v = list(map(int, input().split(' ')))
print(sum(list(map(lambda x: 1 if 5 - x >= k else 0, v))) // 3)


lis0 = [int(x) for x in input().split()]
lis1 = [int(x) for x in input().split()]
i = 0
for x in lis1:
	if x + lis0[1] <= 5:
		i = i + 1
res = i // 3
print(res)


(n, k) = input().split()
y = list(map(int, input().split()))
k = int(k)
l = []
for s in y:
	if s + k <= 5:
		l.append(s)
print(len(l) // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l = list(filter(lambda a: 5 - a >= k, l))
print(len(l) // 3)


import sys
import math
_inputs = [x for x in '6 5\n0 0 0 0 0 0'.split('\n') if bool(x)]
if '--debug' not in sys.argv:
	_inputs = [input() for _ in range(len(_inputs))]
(n, k) = [int(x) for x in _inputs[0].split()]
students = [int(x) for x in _inputs[1].split()]
students = [x for x in students if 5 - x >= k]
print(len(students) // 3)


line = input().split()
n = int(line[0])
k = int(line[1])
line = [int(i) for i in input().split()]
counter = 0
for j in line:
	if 5 - j >= k:
		counter += 1
print(str(counter // 3))


(n, k) = [int(x) for x in input().split(' ')]
p = [int(x) for x in input().split(' ')]
result = 0
for i in p:
	if 5 - i >= k:
		result += 1
print(int(result / 3))


(n, k) = map(int, input().split())
ls = [int(i) + k for i in input().split()]
mem = 0
for i in ls:
	if i <= 5:
		mem += 1
print(mem // 3)


(n, k) = map(int, input().split())
f = list(map(int, input().split()))
h = 0
f.sort()
for i in range(n):
	if 5 - f[i] >= k:
		h += 1
	else:
		break
print(h // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(0, n, 3):
	check = 1
	if i + 3 > n:
		break
	for j in range(3):
		if l[i + j] + k > 5:
			check = 0
			break
	if check:
		ans -= -1
	else:
		break
print(ans)


def cc(k, v):
	v = [x for x in v if x <= 5 - k]
	return len(v) // 3
(n, k) = [int(x) for x in input().split()]
v = [int(x) for x in input().split()]
print(cc(k, v))


(n, k) = map(int, input().split())
students = list(map(int, input().split()))
students.sort(reverse=True)
avail = n
for i in range(n):
	if students[i] + k <= 5:
		avail = i
		break
print(int((n - avail) // 3))


a = []
count = 0
k = input()
kk = k.split()
x = int(kk[0])
z = int(kk[1])
y = input()
for i in range(x):
	m = y.split()
	a.append(int(m[i]))
for i in range(len(a)):
	if 5 - a[i] >= z:
		count = count + 1
print(int(count / 3))


(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.sort()
ansf = 0
for i in range(2, len(arr), 3):
	x = 5 - arr[i]
	if k > x:
		ans = 0
	if k <= x:
		ans = 1
	ansf = ansf + ans
print(ansf)


(n, k) = input().split()
(n, k) = (int(n), int(k))
member = input().split()
eligible = []
for i in range(n):
	if k + int(member[i]) <= 5:
		eligible.append(int(member[i]))
print(len(eligible) // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
l.reverse()
o = 0
for i in l:
	if i <= 5 - k:
		o += 1
	else:
		continue
print(o // 3)


def main():
	(n, k) = map(int, input().split())
	y = list(map(int, input().split()))
	res = sum([1 for i in y if i <= 5 - k])
	print(res // 3)
main()


[n, k] = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
y.sort()
if n < 3:
	print(0)
else:
	c = 0
	for w in range(0, n - n % 3, 3):
		if y[w] + k <= 5 and y[w + 1] + k <= 5 and (y[w + 2] + k <= 5):
			c += 1
	print(c)


(_, k) = input().split()
c = 0
for i in input().split():
	if 5 - int(i) >= int(k):
		c += 1
print(c // 3)


(n, k) = map(int, input().strip().split(' '))
li = list(map(int, input().strip().split(' ')))
member = 0
team = 0
for i in range(n):
	if li[i] + k <= 5:
		member += 1
team = member // 3
print(team)


(n, k) = map(int, input().split())
times = [5 - int(i) for i in input().split()]

def condition(x):
	return x >= k
filtered = list(filter(condition, times))
print(len(filtered) // 3)


(n_val, k_val) = list(map(int, input().split()))
people = list(map(int, input().split()))
team = 0
people_included = 0
idx = 0
while idx < n_val:
	if k_val <= 5 - people[idx]:
		people_included += 1
		if people_included % 3 == 0:
			team += 1
	idx += 1
print(team)


l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
x = 0
for i in range(0, len(l2)):
	if l2[i] + l1[1] <= 5:
		x += 1
print(x // 3)


(n, l) = [int(i) for i in input().split()]
count = 0
a = list(map(int, input().split()))
for i in range(0, n):
	if a[i] + l <= 5:
		count = count + 1
ans = int(count / 3)
print(ans)


(n, k) = map(int, input().split())
times = list(map(int, input().split()))
number = 0
for i in range(6 - k):
	number += times.count(i)
print(number // 3)


import math
(n, k) = input().split()
n = int(n)
k = int(k)
list_of_years = list(map(int, input().split()))
count = 0
for i in list_of_years:
	if 5 - i >= k:
		count = count + 1
total_team = math.floor(count / 3)
print(total_team)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(n, k) = LI()
	a = LI()
	t = 0
	for c in a:
		if 5 - c >= k:
			t += 1
	return t // 3
print(main())


a = list(map(int, input().strip().split()))[:2]
n = a[0]
k = a[1]
b = list(map(int, input().strip().split()))[:n]
count = 0
for data in b:
	if data + k <= 5:
		count += 1
print(count // 3)


nt = [int(i) for i in input().split()]
n = nt[0]
t = nt[1]
member = 0
people = [int(i) for i in input().split()]
for i in range(n):
	if people[i] <= 5 - t:
		member += 1
print(member // 3)


num1 = input()
num2 = input()
a = []
b = []

def get_the_data(count, num, arr):
	for i in range(0, len(num)):
		if num[i] == ' ':
			arr.append(int(num[count:i]))
			count = i + 1
		elif i == len(num) - 1:
			arr.append(int(num[count:len(num)]))
	return arr
arr1 = get_the_data(0, num1, a)
arr2 = get_the_data(0, num2, b)
limit = 5
players = arr1[0]
team = 3
counting = 0
arr2.sort()
for i in range(0, len(arr2) - 2, 3):
	b = arr2[i + 2]
	game = arr1[1]
	while game > 0:
		b += 1
		game -= 1
	if b <= 5:
		counting += 1
print(counting)


s1 = list(map(int, input().split()))
s2 = list(map(int, input().split()))
c = 0
for i in s2:
	if 5 - i >= s1[1]:
		c += 1
print(c // 3)


(n, k) = [int(elem) for elem in input().split()]
(counter, peoples) = (0, [int(elem) for elem in input().split()])
for i in range(n):
	if peoples[i] <= 5 - k:
		counter += 1
print(counter // 3)


(n, k) = tuple(map(int, input().split()))
a = list(map(int, input().split()))
if k == 1:
	sum = a.count(4) + a.count(3) + a.count(2) + a.count(1) + a.count(0)
	print(sum // 3)
elif k == 2:
	sum = a.count(3) + a.count(2) + a.count(1) + a.count(0)
	print(sum // 3)
elif k == 3:
	sum = a.count(2) + a.count(1) + a.count(0)
	print(sum // 3)
elif k == 4:
	sum = a.count(1) + a.count(0)
	print(sum // 3)
elif k == 5:
	sum = a.count(0)
	print(sum // 3)


(n, k) = map(int, input().split())
li = list(map(int, input().split()))
li.sort()
(i, ans) = (0, 0)
while i < len(li) - 2:
	(a, b, c) = (li[i], li[i + 1], li[i + 2])
	ma = max(a, b, c)
	if ma + k <= 5:
		ans += 1
		i += 3
	else:
		i += 1
print(ans)


tmp = [int(i) for i in input().split()]
k = tmp[1]
lst = [int(i) + k for i in input().split() if int(i) + k <= 5]
print(len(lst) // 3)


a = [int(x) for x in input().split()]
(n, k) = (a[0], a[1])
a = [int(x) for x in input().split()]
n = 5 - k
ch = 0
for i in a:
	if i <= n:
		ch += 1
print((ch - ch % 3) // 3)


(n, k) = map(int, input().strip().split())
A = list(map(int, input().strip().split()))
c = 0
for i in A:
	if i + k <= 5:
		c += 1
print(c // 3)


stats = [int(n) for n in input().split()]
n = stats[0]
k = stats[1]
students = [int(n) for n in input().split()]
i = 0
while n != 0:
	if students[i] + k > 5:
		students.pop(i)
		n -= 1
	else:
		n -= 1
		i += 1
print(len(students) // 3)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
i = 3
cnt = 0
l.sort()
while i <= n:
	if l[i - 1] + k <= 5:
		cnt = cnt + 1
	i += 3
print(cnt)


k = int(input().split()[1])

def f(s):
	return s + k
z = list(map(f, list(map(int, input().split()))))
t = [x for x in z if x <= 5]
print(int(len(t) / 3))


from sys import stdin
(n, k) = [int(x) for x in stdin.readline().rstrip().split()]
k = 5 - k
result = len([x for x in stdin.readline().rstrip().split() if int(x) <= k]) // 3
print('{}\n'.format(result))


(n, k) = map(int, input().split())
L = list(map(int, input().split()))
L.sort()
L = [x + k for x in L]
i = 0
c = 0
while i < n and i + 2 < n:
	if L[i] <= 5 and L[i + 1] <= 5 and (L[i + 2] <= 5):
		c += 1
	i += 3
print(c)


line = input()
line = line.split()
n = int(line[0])
k = int(line[1])
line = input()
line = line.split()
team = 0
for i in range(0, n):
	line[i] = int(line[i])
	if line[i] <= 5 - k:
		team = team + 1
print(team // 3)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
count = 0
plus = 0
for i in range(n):
	if 5 - l[i] >= m:
		count += 1
		if count % 3 == 0:
			plus += 1
if plus > 0:
	print(plus)
else:
	print('0')


(n, k) = [int(x) for x in input().split()]
times = [int(x) for x in input().split()]
times.sort()
counter = teams = 0
for person in times:
	if person + k <= 5:
		counter += 1
		if counter % 3 == 0:
			teams += 1
			counter = 0
	else:
		break
print(teams)


import itertools

def main():
	(n, k) = [int(v) for v in input().split()]
	data = [int(v) for v in input().split()]
	data.sort()
	r = 0
	for i in range(0, n, 3):
		if i + 3 > n:
			continue
		if all([v + k <= 5 for v in data[i:i + 3]]):
			r += 1
	print(r)
main()


__author__ = 'runekri3'
(n, k) = list(map(int, input().split()))
max_participations = 5 - k
qualifying_people = 0
for person in input().split():
	if int(person) <= max_participations:
		qualifying_people += 1
print(qualifying_people // 3)


(n, k) = [int(i) for i in input().split()]
p = [int(i) <= 5 - k for i in input().split()]
print(sum(p) // 3)


(n, k) = [int(x) for x in input().split()]
ys = [int(x) for x in input().split()]
v = len([x for x in ys if x <= 5 - k])
print(int(v / 3))