Roma (a popular Russian name that means 'Roman') loves the Little Lvov Elephant's lucky numbers.

Let us remind you that lucky numbers are positive integers whose decimal representation only contains lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

Roma's got n positive integers. He wonders, how many of those integers have not more than k lucky digits? Help him, write the program that solves the problem.


-----Input-----

The first line contains two integers n, k (1 ≤ n, k ≤ 100). The second line contains n integers a_{i} (1 ≤ a_{i} ≤ 10^9) — the numbers that Roma has. 

The numbers in the lines are separated by single spaces.


-----Output-----

In a single line print a single integer — the answer to the problem.


-----Examples-----
Input
3 4
1 2 4

Output
3

Input
3 2
447 44 77

Output
2



-----Note-----

In the first sample all numbers contain at most four lucky digits, so the answer is 3.

In the second sample number 447 doesn't fit in, as it contains more than two lucky digits. All other numbers are fine, so the answer is 2.

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
def dragon(n):
	t = 0
	while n != 0:
		y = n % 10
		n = n // 10
		if y == 4 or y == 7:
			t = t + 1
	return t
(n, k) = [int(i) for i in input().split()]
t = 0
s = [int(i) for i in input().split()]
for i in range(n):
	if dragon(s[i]) <= k:
		t = t + 1
print(t)


(n, k) = map(int, input().split())
print(len([i for i in input().split() if i.count('4') + i.count('7') <= k]))


def number_of_lucky_digits(num):
	temp = num
	counter = 0
	while temp != 0:
		digit = temp % 10
		if digit == 4 or digit == 7:
			counter += 1
		temp = temp // 10
	return counter
vals = [int(n) for n in input().split()]
n = vals[0]
maxDigitis = vals[1]
nums = [int(x) for x in input().split()]
counter = 0
for num in nums:
	if number_of_lucky_digits(num) <= maxDigitis:
		counter += 1
print(counter)


(n, k) = map(int, input().split())
ans = 0
nums = list(input().split())
for i in nums:
	if i.count('4') + i.count('7') <= k:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
l = [int(s) for s in input().split()]
c = 0
for i in l:
	k1 = str(i)
	m = k1.count('4') + k1.count('7')
	if m <= k:
		c += 1
print(c)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
answer = 0
for i in a:
	if str(i).count('7') + str(i).count('4') <= k:
		answer += 1
print(answer)


(a, b) = map(int, input().split())
ar = input().split()
rez = 0
for i in ar:
	if i.count('4') + i.count('7') <= b:
		rez += 1
print(rez)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect, insort
from time import perf_counter
from fractions import Fraction
import copy
from copy import deepcopy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

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

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

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

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')
(n, k) = L()
A = L()
cnt = 0
for ele in A:
	ele = list(str(ele))
	x = ele.count('4')
	y = ele.count('7')
	if x + y <= k:
		cnt += 1
print(cnt)
endtime = time.time()


(a, b) = map(int, input().split())
arr = list(map(int, input().split()))
ans = 0
for i in arr:
	a = str(i)
	if a.count('4') + a.count('7') <= b:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
arr = input().split()
res = 0
for i in arr:
	res += i.count('4') + i.count('7') <= k
print(res)


(a, b) = map(int, input().split())
c = list(input().split())
cnt = 0
for i in range(len(c)):
	g = 10 ** b
	if int(c[i]) // g <= 1:
		cnt += 1
	elif c[i].count('4') + c[i].count('7') <= b:
		cnt += 1
print(cnt)


(n, k) = list(map(int, input().split()))
data = list(map(int, input().split()))
ans = 0
for item in data:
	tmp = 0
	for elem in str(item):
		if elem == '7' or elem == '4':
			tmp += 1
	if tmp <= k:
		ans += 1
print(ans)


(n, k) = list(map(int, input().split()))
num = list(map(int, input().split()))
c = 0
for i in num:
	if str(i).count('4') + str(i).count('7') <= k:
		c += 1
print(c)


(n, k) = map(int, input().split())
a = input().split()
r = 0
for x in a:
	if x.count('4') + x.count('7') <= k:
		r += 1
print(r)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
s = [str(x).count('4') + str(x).count('7') for x in l]
kil = 0
for i in s:
	if int(i) <= k:
		kil += 1
print(kil)


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

def has_not_more_than_k_lucky(number: str, k: int) -> bool:
	return number.count('4') + number.count('7') <= k

def count_lucky(numbers: list, k: int) -> int:
	return sum((has_not_more_than_k_lucky(number, k) for number in numbers))

def main() -> int:
	(n, k) = map(int, input().split())
	numbers = input().split()
	print(count_lucky(numbers, k))
	return 0

def __starting_point():
	exit(main())
__starting_point()


(a, b) = map(int, input().split())
c = input().split()
count = 0
for i in c:
	answer = 0
	for j in i:
		if j == '4' or j == '7':
			answer += 1
	if answer <= b:
		count += 1
print(count)


def getlc(num):
	ans = 0
	while num > 0:
		if num % 10 == 4 or num % 10 == 7:
			ans += 1
		num //= 10
	return ans
s = input().split()
n = int(s[0])
k = int(s[1])
m = map(int, input().split())
res = 0
for i in m:
	if getlc(i) <= k:
		res += 1
print(res)


(n, k) = map(int, input().split())
a = list(map(str, input().split()))
mcnt = 0
for i in a:
	cnt = 0
	for word in i:
		if word == '4' or word == '7':
			cnt += 1
	if cnt <= k:
		mcnt += 1
print(mcnt)


(n, k) = map(int, input().split())
L = list(map(str, input().split()))
ans = 0
for l in L:
	if l.count('4') + l.count('7') <= k:
		ans += 1
print(ans)


luck_digits = lambda x: sum([1 for i in x if i == '4' or i == '7'])

def solve(n, k, a):
	c = 0
	for i in a:
		if luck_digits(str(i)) <= k:
			c += 1
	return c

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


(n, k) = map(int, input().split())
a = list(input().split())
m = 0
for i in a:
	x = i.count('4') + i.count('7')
	if x > k:
		m += 1
print(n - m)


(n, k) = list(map(int, input().split()))
l = input().split()
print(sum([i.count('4') + i.count('7') <= k for i in l]))


(n, k) = input().split()
n = int(n)
k = int(k)
num = list(map(str, input().split()))
kou = 0
for i in num:
	count = 0
	flag = 1
	for j in i:
		if count > k:
			flag = 0
			break
		if j == '4' or j == '7':
			count += 1
	if count > k:
		flag = 0
	if flag == 1:
		kou += 1
print(kou)


(n, k) = [int(i) for i in input().split()]

def f(a, k):
	t = 0
	for i in a:
		if i == '4' or i == '7':
			t += 1
	if t > k:
		return -1
	return 1
a = input().split()
p = 0
for i in a:
	if f(i, k) == 1:
		p += 1
print(p)


(n, k) = map(int, input().split())
ans = 0
digits = input().split()
for i in digits:
	temp = 0
	for j in i:
		if j == '4' or j == '7':
			temp += 1
			if temp > k:
				break
	else:
		if temp <= k:
			ans += 1
print(ans)


from sys import stdin, stdout
nk = list(map(int, stdin.readline().strip().split()))
n = nk[0]
k = nk[1]
num_lst = list(map(int, stdin.readline().split()))
count = 0
for num in num_lst:
	temp = list(str(num))
	if temp.count('4') + temp.count('7') <= k:
		count += 1
stdout.write(str(count))


a = list(map(int, input().split()))
(n, k, ans) = (a[0], a[1], 0)
b = list(map(int, input().split()))
for i in range(n):
	count = 0
	for j in str(b[i]):
		if j == '4' or j == '7':
			count += 1
	if count <= k:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
a = list(map(str, input().split()))
c = 0
for i in a:
	x = list(i)
	y = x.count('7') + x.count('4')
	if y <= k:
		c += 1
print(c)


N = list(map(int, input().split()))
T = list(map(int, input().split()))
C = 0
for _ in range(N[0]):
	if str(T[_]).count('4') + str(T[_]).count('7') <= N[1]:
		C += 1
print(C)


(n, k) = input().split()
a = list(input().split())
ans = 0
for num in a:
	count_lucky = num.count('4') + num.count('7')
	if count_lucky <= int(k):
		ans += 1
print(ans)


(n, k) = map(int, input().split())
tot = 0
l = list(map(str, input().split()))
for i in l:
	count = 0
	if '7' in i:
		count += i.count('7')
	if '4' in i:
		count += i.count('4')
	if count >= 0 and count <= k:
		tot += 1
print(tot)


(n, k) = map(int, input().split())
L = input().split()
ans = 0
for i in range(n):
	x = 0
	for item in L[i]:
		if item == '4' or item == '7':
			x += 1
	if x <= k:
		ans += 1
print(ans)


import sys
from functools import reduce
from collections import Counter
import time
import datetime
import math

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

def sip():
	return input()

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

def mips():
	return map(str, sys.stdin.readline().split())

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

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.insert(i, arr)
	return lst

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

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)

def check_prime(n):
	if n < 2:
		return False
	for i in range(2, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
(n, k) = mip()
arr = lip()
val = 0
for i in range(n):
	flag = 0
	count = 0
	while arr[i] > 0 and flag == 0:
		d = arr[i] % 10
		arr[i] = arr[i] // 10
		if d == 4 or d == 7:
			count += 1
		if count > k:
			flag = 1
	if flag == 0:
		val += 1
print(val)


__author__ = 'Dilshod'
(n, k) = map(int, input().split())
m = list(map(str, input().split()))
cnt = 0
for i in range(n):
	four = m[i].count('4')
	seven = m[i].count('7')
	if four + seven <= k:
		cnt += 1
print(cnt)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
for i in l:
	c = 0
	while i > 0:
		t = i % 10
		if t == 4 or t == 7:
			c += 1
		i = i // 10
	if c <= k:
		ans += 1
print(ans)


def numOfLuckyDigits(n):
	d = 0
	for i in n:
		if i == '4' or i == '7':
			d += 1
	return d
(n, k) = map(int, input().split())
nums = list(input().split())
ans = 0
for i in nums:
	if numOfLuckyDigits(i) <= k:
		ans += 1
print(ans)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))

def lucky(e):
	a = str(e)
	c = 0
	for i in range(len(a)):
		if int(a[i]) == 7 or int(a[i]) == 4:
			c += 1
	return c
c = 0
for i in range(len(a)):
	if len(str(a[i])) < m:
		c += 1
	elif lucky(a[i]) <= m:
		c += 1
print(c)


k = int(input().split()[1])
c = 0
for i in input().split():
	if i.count('4') + i.count('7') <= k:
		c += 1
print(c)


(a, b) = map(int, input().split())
c = list(map(int, input().split()))
counter = 0
for i in c:
	x = str(i)
	if x.count('4') + x.count('7') <= b:
		counter += 1
print(counter)


nk = input().split()
n = int(nk[0])
k = int(nk[1])
s = list(map(int, input().rstrip().split()))
b = 0
for i in range(n):
	j = str(s[i])
	c = 0
	for a in j:
		a = int(a)
		if a == 4 or a == 7:
			c = c + 1
	if c <= k:
		b = b + 1
print(b)


(n, k) = map(int, input().split())
ans = 0
A = input().split()
for a in A:
	n4 = a.count('4')
	n7 = a.count('7')
	if n4 + n7 <= k:
		ans += 1
print(ans)


(m, n) = map(int, input().split())
c = 0
for i in list(input().split(' ')):
	if i.count('4') + i.count('7') <= n:
		c += 1
print(c)


import sys

def main():
	(_, k, *l) = sys.stdin.read().strip().split()
	return sum((sum((i in '47' for i in s)) <= int(k) for s in l))
print(main())


(n, k) = [int(i) for i in input().split()]
arr = [int(i) for i in input().split()]
arr.sort()
t = 0
for i in arr:
	if str(i).count('4') + str(i).count('7') < k + 1:
		t += 1
print(t)


(n, k) = map(int, input().split())
l = list(input().split())
res = 0
for i in l:
	cont = 0
	for j in range(len(i)):
		if i[j] == '4' or i[j] == '7':
			cont += 1
	if cont <= k:
		res += 1
print(res)


(n, k) = map(int, input().split())
l = list(input().split())
d = 0
for x in range(n):
	a = list(l[x])
	b = a.count('4')
	c = a.count('7')
	if b + c <= k:
		d += 1
print(d)


from collections import Counter
(n, k) = map(int, input().split())
ls = list(map(str, input().split()))
c = 0
for i in ls:
	if i.count('7') + i.count('4') <= k:
		c += 1
print(c)


(n, k) = map(int, input().split())
a = list(input().split())
d = []
for i in a:
	d1 = i.count('4')
	d1 += i.count('7')
	d.append(d1)
d.sort()
i = n
while d[i - 1] > k and i > 0:
	i -= 1
print(i)


line = list(map(int, input().split()))
n = line[0]
k = line[1]
ld = [4, 7]
no = 0
nos = input().split()
for l in nos:
	lis = list(map(int, list(l)))
	nn = 0
	for j in lis:
		if j in ld:
			nn = nn + 1
	if nn <= k:
		no = no + 1
print(no)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
count1 = count2 = 0
for i in a:
	count1 = 0
	while i:
		if i % 10 == 4 or i % 10 == 7:
			count1 = count1 + 1
		i = i // 10
	if count1 <= k:
		count2 = count2 + 1
print(count2)


(n, k) = map(int, input().split())
num = [int(x) for x in input().split()]
(count, luck) = (0, [4, 7])
for i in num:
	if len(str(i)) <= k:
		count += 1
	else:
		c = 0
		while i != 0:
			d = i % 10
			i //= 10
			if d in luck:
				c += 1
		if c <= k:
			count += 1
print(count)


s = 0
x = list(map(int, input().split()))
y = list(map(str, input().split()))
for i in y:
	z = i
	if z.count('4') + z.count('7') <= x[1]:
		s += 1
print(s)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
cnt = 0
for i in range(0, n):
	x = str(a[i]).count('4') + str(a[i]).count('7')
	if len(str(a[i])) <= k:
		cnt += 1
	elif x <= k:
		cnt += 1
print(cnt)


def f(n):
	s = 0
	for a in list(str(n)):
		if a == '4' or a == '7':
			s += 1
	return s
(n, k) = map(int, input().split())
l = [int(i) for i in input().split()]
s1 = 0
for a in l:
	if f(a) <= k:
		s1 += 1
print(s1)


(n, k) = map(int, input().split())
(d, res) = ({}, 0)
for i in input().split():
	d.setdefault(len(i), []).append(i)
for j in d:
	if j <= k:
		res += len(d.get(j, []))
	else:
		res += len([v for v in d.get(j, []) if v.count('4') + v.count('7') <= k])
print(res)


(n, k) = map(int, input().split())
s = [i for i in input().split()]
c = 0
for i in range(n):
	if s[i].count('4') + s[i].count('7') <= k:
		c += 1
print(c)


(n, k) = map(int, input().split())
lst = [x for x in input().split()]
total = 0
for i in lst:
	counter = 0
	for j in i:
		if j == '7' or j == '4':
			counter += 1
	if counter <= k:
		total += 1
print(total)


(n, k) = list(map(int, input().split()))
a = input().split()
print(sum([1 for i in a if i.count('4') + i.count('7') <= k]))


(n, m) = map(int, input().split())
c = n
li = list(map(str, input().split()))
for i in range(n):
	if li[i].count('4') + li[i].count('7') > m:
		c -= 1
print(c)


[n, k] = [int(x) for x in input().split()]
L = [x for x in input().split()]
c = 0
for i in L:
	if i.count('4') + i.count('7') <= k:
		c += 1
print(c)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
(c, c1) = (0, 0)
for i in range(n):
	s = str(l[i])
	c = s.count('4') + s.count('7')
	if c <= k:
		c1 += 1
print(c1)


def check_number(num, k):
	count = 0
	while num:
		count += num % 10 in {4, 7}
		num //= 10
	return count <= k
res = 0
(n, k) = map(int, input().split())
for a in map(int, input().split()):
	res += check_number(a, k)
print(res)


(n, k) = [int(x) for x in input().split()]
l = input().split()
c = 0
d = 0
for i in range(n):
	for j in range(len(l[i])):
		if l[i][j] == '4' or l[i][j] == '7':
			c += 1
	if c <= k:
		d += 1
	c = 0
print(d)


(n, k) = map(int, input().split())
s = [i for i in input().split()]
total = 0
for i in range(n):
	cont = 0
	for j in s[i]:
		if j == '4' or j == '7':
			cont += 1
	if cont <= k:
		total += 1
print(total)


q = lambda : map(int, input().split())
qi = lambda : int(input())
qs = lambda : input().split()
(n, m) = q()
c = 0
for i in qs():
	c += i.count('4') + i.count('7') <= m
print(c)


(a, b) = map(int, input().split())
c = list(map(str, input().split()))
d = []
for i in c:
	if i.count('4') + i.count('7') <= b:
		d.append(i)
print(len(d))


(n, k) = map(int, input().split())
l = list(input().split(' '))
c = 0
ans = 0
for i in range(n):
	for j in range(len(l[i])):
		if l[i][j] == '7' or l[i][j] == '4':
			c += 1
	if c <= k:
		ans += 1
	c = 0
print(ans)


(n, k) = map(int, input().split())
ls = input().split()
main_cnt = 0
for i in ls:
	cnt = 0
	for j in i:
		if j == '4' or j == '7':
			cnt += 1
	if cnt <= k:
		main_cnt += 1
print(main_cnt)


(n, k) = [int(i) for i in input().split()]
l = [x for x in input().split()]
for i in l:
	soma = i.count('4') + i.count('7')
	if soma > k:
		n -= 1
print(n)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
count = 0
for i in range(n):
	s = str(l[i])
	st = set(s)
	if s.count('4') + s.count('7') <= m:
		count += 1
print(count)


(n, k) = list(map(int, input().split()))
A = list(input().split())
ans = 0
for item in A:
	if item.count('4') + item.count('7') <= k:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
count = 0
b = list(map(int, input().split()))
for i in range(n):
	a = list(map(int, str(b[i])))
	c = a.count(7) + a.count(4)
	if c <= k:
		count += 1
print(count)


(n, k) = [int(x) for x in input().split()]
nums = [x for x in input().split()]
valid = 0
for x in nums:
	has = x.count('4') + x.count('7')
	valid += has <= k
print(valid)


a = input().split()
b = int(a[0])
c = int(a[1])
s = input().split()
d = 0
for i in s:
	i = str(i)
	if i.count('4') + i.count('7') > c:
		d = d + 1
r = b - d
print(r)


(_, k) = map(int, input().split())
res = [1 for st in input().split() if st.count('4') + st.count('7') <= k]
print(sum(res))


def cnt(n, k):
	cnt = 0
	while n:
		if n % 10 in (4, 7):
			cnt += 1
		n = n // 10
	return cnt <= k
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = list(filter(lambda x: cnt(x, k), a))
print(len(a))


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
c = 0
for i in a:
	if i < 10 ** k:
		c += 1
	else:
		l = list(str(i))
		m = 0
		for j in l:
			if j == '4' or j == '7':
				m += 1
			if m > k:
				break
		else:
			c += 1
print(c)


def roma(k, a):
	res = 0
	for i in range(len(a)):
		n = a[i]
		count = 0
		while n > 0:
			digit = n % 10
			if digit == 4 or digit == 7:
				count += 1
			n = n // 10
		if count <= k:
			res += 1
	print(res)
n = list(map(int, input('').split()))
a = list(map(int, input('').split()))
roma(n[1], a)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
c = 0
for i in l:
	if i < 10:
		c += 1
	elif i < 10 ** m:
		c += 1
	else:
		a = str(i).count('4')
		b = str(i).count('7')
		if a + b <= m:
			c += 1
print(c)


def lf(n):
	c = 0
	while n > 0:
		if n % 10 == 4 or n % 10 == 7:
			c += 1
		n = n // 10
	return c

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

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

def li():
	return list(mi())
(n, k) = mi()
a = li()
count = 0
for i in range(n):
	if lf(a[i]) <= k:
		count += 1
print(count)


(n, k) = map(int, input().split())
d = [x for x in map(int, input().split())]
ans = 0
for x in d:
	cnt = 0
	while x > 0:
		if x % 10 == 7 or x % 10 == 4:
			cnt += 1
		x //= 10
	if cnt <= k:
		ans += 1
print(ans)


def lucky(d):
	n1 = 0
	while d:
		if d % 10 == 4 or d % 10 == 7:
			n1 += 1
		d //= 10
	if n1 <= k:
		return 1
	else:
		return 0
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
c = 0
for i in range(n):
	c += lucky(l[i])
print(c)


(n, q) = map(int, input().split())
ll = input().split()
otvet = 0
for i in ll:
	j = 0
	for k in i:
		if k in ['4', '7']:
			j += 1
	if j <= q:
		otvet += 1
print(otvet)


inp = input().split()
n = int(inp[0])
k = int(inp[1])
a = list(map(int, input().split()))
count = 0
for i in range(n):
	lucky = 0
	for num in str(a[i]):
		if num == '4' or num == '7':
			lucky += 1
	if lucky <= k:
		count += 1
print(count)


list_1 = [int(x) for x in input().split(' ')]
list = [x for x in input().split(' ')]
luck = 0
total = 0
for num in list:
	luck = 0
	for digit in num:
		if digit == '7' or digit == '4':
			luck += 1
	if luck <= list_1[1]:
		total += 1
print(total)


(x, y) = map(int, input().strip().split())
l = list(map(str, input().strip().split()))
n = 0
for i in l:
	count = 0
	for j in i:
		if j == '4' or j == '7':
			count += 1
	if count <= y:
		n += 1
print(n)


inp = input().split()
n = int(inp[0])
k = int(inp[1])
inp = input().split()
num = [int(i) for i in inp]
ans = 0
for i in num:
	count = 0
	while i > 0:
		if i % 10 == 4 or i % 10 == 7:
			count += 1
		i = i // 10
	if count <= k:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
arr = list(map(list, input().split()))
cnt_lucky = []
for item in arr:
	cnt = 0
	for itr in item:
		if itr == '7' or itr == '4':
			cnt += 1
	if cnt <= k:
		cnt_lucky.append(cnt)
print(len(cnt_lucky))


(n, k) = map(int, input().split())
numbers = list(map(int, input().split()))
result = 0
for number in numbers:
	new_string = str(number)
	edit_string = new_string.replace('4', '').replace('7', '')
	diff = int(len(new_string) - len(edit_string))
	if diff <= k:
		result += 1
print(result)


R = lambda : map(int, input().split())
(n, k) = R()
L = list(R())
res = 0
for i in range(n):
	p = L[i]
	c = 0
	while p > 0:
		(p, m) = divmod(p, 10)
		if m == 4 or m == 7:
			c += 1
	if c <= k:
		res += 1
print(res)


(n, k) = str(input()).split()
n = int(n)
k = int(k)
line = str(input()).split()
tar = 0
for i in range(n):
	size = len(line[i])
	line[i] = line[i].replace('4', '').replace('7', '')
	size -= len(line[i])
	if k >= size:
		tar += 1
print(tar)


(n, k) = map(int, input().split())
l = input().split()
result = 0
for i in l:
	if k >= i.count('4') + +i.count('7'):
		result += 1
print(result)


def getLuckyDigits(n):
	luckyDigits: int = 0
	luckyNums = [4, 7]
	while n > 0:
		if int(n % 10) in luckyNums:
			luckyDigits += 1
		n = int(n / 10)
	return luckyDigits

def getDigits(num):
	return len(str(num))
arr = input().split(' ')
n = int(arr[0])
k = int(arr[1])
count = 0
nums = input().split(' ')
for i in range(n):
	currentNumber = int(nums[i])
	if getLuckyDigits(currentNumber) <= k:
		count += 1
print(count)


def main():
	(n, k) = map(int, input().strip().split())
	print(sum((s.count('4') + s.count('7') <= k for s in input().strip().split())))
main()


(n, m) = map(int, input().split())
s = input().split()
l = 0
for i in range(n):
	if s[i].count('4') + s[i].count('7') <= m:
		l += 1
print(l)


(n, k) = [int(i) for i in input().split()]
a = input().split()
all = 0
for i in a:
	t = 0
	for j in i:
		if j == '4' or j == '7':
			t += 1
	if t <= k:
		all += 1
print(all)


(n, k) = map(int, input().split(' '))
array1 = list(map(str, input().split(' ')))
count = 0
for i in range(n):
	a = array1[i].count('4')
	b = array1[i].count('7')
	sum = a + b
	if sum > k:
		continue
	elif sum <= k:
		count = count + 1
print(count)


def luck(n):
	total = 0
	for char in n:
		if char == '4' or char == '7':
			total += 1
	return total
sa = input().split(' ')
magic = int(sa[1])
check = input().split(' ')
total1 = 0
for element in check:
	if luck(element) <= magic:
		total1 += 1
print(total1)


(n, d) = map(int, input().split())
w = list(input().split())
r = 0
for it in w:
	s = 0
	for i in it:
		if i == '4' or i == '7':
			s += 1
	if s <= d:
		r += 1
print(r)


k = int(input().split(' ')[1])
nums = input().split()
print(len(list(filter(lambda x: 1 if x.count('4') + x.count('7') <= k else 0, nums))))


def main():
	from re import subn
	[n, k] = [int(_) for _ in input().split()]
	numbers = input().split()
	counts_lucky_digits = [n_lucky_digits for (_, n_lucky_digits) in [subn('[47]', '', x) for x in numbers]]
	print(sum((count <= k for count in counts_lucky_digits)))
main()


(n, k) = input().split()
n = int(n)
k = int(k)
l = list(map(int, input().split()))
count = 0
for i in l:
	temp = 0
	s = str(i)
	for ele in s:
		if ele == '4' or ele == '7':
			temp += 1
	if temp <= k:
		count += 1
print(count)


(n, k) = input().split()
l = list(input().split())
x = 0
for i in range(len(l)):
	a = l[i].count('4')
	b = l[i].count('7')
	if a + b <= int(k):
		x += 1
print(x)


t = input().split()
n = int(t[0])
k = int(t[1])
t = input().split()
slon = temp = 0
for i in range(len(t)):
	temp = t[i].count('4') + t[i].count('7')
	if temp <= k:
		slon += 1
print(slon)


(x, y) = list(map(int, input().split()))
nums = list(map(int, input().split()))
c = 0
for i in nums:
	i = str(i)
	if i.count('4') + i.count('7') <= y:
		c += 1
print(c)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
s = 0
for i in range(n):
	s += 1
	s1 = 0
	while a[i] > 0:
		if a[i] % 10 == 4 or a[i] % 10 == 7:
			s1 += 1
		a[i] = a[i] // 10
		if s1 > m:
			s -= 1
			break
print(s)


(n, k) = map(int, input().split(' '))
res = 0
for i in input().split(' '):
	if i.count('4') + i.count('7') <= k:
		res += 1
print(res)


(n, k) = map(int, input().split())
ans = 0
l = list(map(str, input().split()))
for i in range(n):
	a = 0
	a = l[i].count('4') + l[i].count('7')
	if a <= k:
		ans += 1
print(ans)


(a, b) = map(int, input().split())
l = list(map(str, input().split()))
sum = 0

def lucknum(k):
	p = 0
	for i in range(len(k)):
		if k[i] == '4' or k[i] == '7':
			p = p + 1
	return p
for i in range(a):
	if lucknum(l[i]) > b:
		sum = sum + 1
print(a - sum)


(x, y) = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for i in range(x):
	t = 0
	while a[i]:
		r = a[i] % 10
		if r == 4 or r == 7:
			t = t + 1
		a[i] = int(a[i] / 10)
	if t <= y:
		count = count + 1
print(count)


(n, k) = map(int, input().split())
l = list(map(str, input().split()))
a = []
cou = 0
for i in l:
	a.append(i.count('4') + i.count('7'))
for i in a:
	if i > k:
		cou += 1
print(len(a) - cou)


a = int(input().split()[1])
b = input().split()
print(len([i for i in b if i.count('4') + i.count('7') <= a]))


(n, k) = map(int, input().split())
lis = [i for i in input().split()]
ans = 0
for i in lis:
	c = i.count('4') + i.count('7')
	if c <= k:
		ans += 1
print(ans)


def schast_e___e(a):
	a = str(a)
	h = 0
	for i in range(len(a)):
		if a[i] == '4' or a[i] == '7':
			h += 1
	return h
(n, k) = map(int, input().split())
j = 0
s = input().split()
for i in range(n):
	if schast_e___e(s[i]) <= k:
		j += 1
print(j)


def count(n):
	res = 0
	while n > 0:
		if n % 10 == 4 or n % 10 == 7:
			res += 1
		n = int(n / 10)
	return res
(n, k) = [int(j) for j in input().split()]
nums = [int(j) for j in input().split()]
res = 0
for j in range(n):
	if count(nums[j]) <= k:
		res += 1
print(res)


(n, k) = map(int, input().split())
l = input().split()
l_br = ['4', '7']
br = 0
r = 0
for i in range(n):
	for j in range(len(l[i])):
		if l[i][j] in l_br:
			br += 1
	if br <= k:
		r += 1
	br = 0
print(r)


import sys
(n, k) = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
ans = 0
for i in a:
	si = sum(map(lambda x: 1 if x == '7' or x == '4' else 0, str(i)))
	if si <= k:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
li = list(map(int, input().split()))
c = 0
for i in li:
	if len(str(i)) > k:
		if str(i).count('4') + str(i).count('7') <= k:
			c = c + 1
	else:
		c = c + 1
print(c)


def main():
	(n, k) = map(int, input().split())
	seq = input().split()
	ans = 0
	for e in seq:
		num_lucky = e.count('4') + e.count('7')
		if num_lucky <= k:
			ans += 1
	print(ans)
main()


(n, k) = list(map(int, input().split()))
ints = list(map(int, input().split()))
good = 0
l = 0
for num in ints:
	for char in str(num):
		if char == '4' or char == '7':
			l += 1
	if l <= k:
		good += 1
	l = 0
print(good)


(n, k) = list(map(int, input().split()))
s = input().split()
result = 0
for m in s:
	res = 0
	res += m.count('4')
	res += m.count('7')
	if res <= k:
		result += 1
print(result)


(n, m) = map(int, input().split())
arr = list(map(str, input().split(' ')[:n]))
ans = 0

def lucky(s):
	temp = 0
	for i in range(len(s)):
		if s[i] == '7' or s[i] == '4':
			temp += 1
	if temp <= m:
		return 1
	else:
		return 0
for i in range(n):
	if lucky(arr[i]) == 1:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
l = []
c = c1 = 0
l.extend(input().split())
for i in l:
	for j in i:
		if j == '4' or j == '7':
			c += 1
	if c <= k:
		c1 += 1
	c = 0
print(c1)


(a, b) = map(int, input().split())
n = input().split()
l = 0
for i in n:
	if i.count('4') + i.count('7') <= b:
		l += 1
print(l)


(n, k) = map(int, input().split())
print(sum((el.count('4') + el.count('7') <= k for el in input().split())))


def main():

	def f(s):
		r = 0
		for c in str(s):
			if c == '7' or c == '4':
				r += 1
		return r
	(n, k) = map(int, input().split(' '))
	a = list(map(int, input().split(' ')))
	x = 0
	for (i, ai) in enumerate(a):
		if f(ai) <= k:
			x += 1
	return x
print(main())


(n, k) = list(map(int, input().split(' ')))
nums = list(input().split(' '))
print(len([1 for num in nums if num.count('4') + num.count('7') <= k]))


l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
total = 0
for i in l2:
	co = 0
	while i != 0:
		n = i % 10
		i //= 10
		if n == 4 or n == 7:
			co += 1
	if co <= l1[1]:
		total += 1
print(total)


(n, k) = map(int, input().split())
A = map(int, input().split())
c = 0
for a in A:
	s = str(a)
	n4 = s.count('4')
	n7 = s.count('7')
	if n4 + n7 <= k:
		c += 1
print(c)


(n, m) = map(int, input().split())
a = list(map(str, input().split()))
counter = len(a)
for item in a:
	if item.count('7') + item.count('4') > m:
		counter -= 1
print(counter)


from collections import Counter

def check(h, k):
	s = str(h)
	a = Counter(s)
	d = a['4']
	e = a['7']
	if d + e <= k:
		return True
	else:
		return False
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
r = 0
for i in l:
	if check(i, k):
		r = r + 1
print(r)


(n, k) = map(int, input().split())
luckynums = list(map(str, input().split()))
zero = 0
for i in luckynums:
	if i.count('4') + i.count('7') <= k:
		zero += 1
print(zero)


def luckyCount(arr, k):
	count = 0
	for num in arr:
		luckyDigits = 0
		while num > 0:
			if num % 10 in (4, 7):
				luckyDigits += 1
			num //= 10
		if luckyDigits <= k:
			count += 1
	return count
(n, k) = map(int, input().split())
nums = list(map(int, input().split()))
print(luckyCount(nums, k))


s = input().split()
n = int(s[0])
k = int(s[1])
l = input().split()
cnt = 0
for i in range(n):
	if l[i].count('4') + l[i].count('7') <= k:
		cnt += 1
print(cnt)


(a, b) = map(int, input().split())
c = list(map(int, input().split()))
count = 0
for x in range(a):
	d = list(str(c[x]))
	seven = d.count('7')
	four = d.count('4')
	if seven + four <= b:
		count += 1
print(count)


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
from types import new_class
(n, k) = map(int, input().split())
a = [x for x in input().split()]
ans = 0
for x in a:
	cnt = 0
	for y in x:
		cnt += y == '4' or y == '7'
	ans += cnt <= k
print(ans)


(n, k) = map(int, input().split())
s = 0
l = list(input().split())
for element in l:
	c4 = element.count('4')
	c7 = element.count('7')
	if c4 + c7 in range(k + 1):
		s += 1
print(s)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
for e in l:
	c = 0
	while e != 0:
		if e % 10 in [4, 7]:
			c += 1
		e = e // 10
	if c <= k:
		ans += 1
print(ans)


(n, m) = map(int, input().split())
l = list(map(str, input().split()))
p = 0
s = 0
for i in range(n):
	j = l[i].count('7')
	k = l[i].count('4')
	if j + k > m:
		p += 1
	else:
		s += 1
print(s)


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : list(input())
ips = lambda : input().split()
(a, b) = ml()
ans = 0
l = list(input().split())
for i in l:
	k = i
	w = 0
	for i in k:
		if i == '4' or i == '7':
			w += 1
	if w <= b:
		ans += 1
print(ans)


(n, k) = (int(x) for x in input().split())
a = [x for x in input().split()]
ans = 0
for x in a:
	p = 0
	for y in x:
		if y in ['4', '7']:
			p += 1
	if p <= k:
		ans += 1
print(ans)


string = input()
numbers = string.split()
a = int(numbers[1])
string = input()
numbers = string.split()
n = 0
for x in numbers:
	if x.count('4') + x.count('7') <= a:
		n += 1
print(n)


(n, k) = map(int, input().split())
n1 = list(map(str, input().split()))
a = 0
for i in range(len(n1)):
	m = list(n1[i])
	c = m.count('4')
	d = m.count('7')
	if c + d <= k:
		a = a + 1
print(a)


(n, m) = list(map(int, input().strip().split()))
l = list(map(int, input().strip().split()))
p = 0
for i in l:
	s = str(i)
	t = s.count('4') + s.count('7')
	if t <= m:
		p += 1
print(p)


(n, k) = map(int, input().split())
x = list(map(int, input().split()))
t = 0
for i in range(n):
	l = str(x[i])
	y = l.count('4')
	z = l.count('7')
	if y + z > k:
		t += 1
print(n - t)


(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
cnt = 0
for i in arr:
	c = 0
	for j in str(i):
		if j == '4' or j == '7':
			c += 1
	if c <= k:
		cnt += 1
print(cnt)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
k = 0
p = 0
for i in range(len(a)):
	a[i] = str(a[i])
	for j in range(len(a[i])):
		if a[i][j] == '7' or a[i][j] == '4':
			p += 1
		if p > m:
			break
	if p <= m:
		k += 1
	p = 0
print(k)


(a, b) = input().split()
(a, b) = (int(a), int(b))
c = input().split()
k = 0
for i in range(a):
	if c[i].count('4') + c[i].count('7') <= b:
		k += 1
print(k)


(n, k) = map(int, input().split())
l = input().split()
count = 0
for num in l:
	if num.count('4') + num.count('7') <= k:
		count += 1
print(count)


(n, k) = map(int, input().split())
temp = 0
arr = [str(x) for x in input().split()]
temp = 0
for i in range(0, len(arr), 1):
	s = arr[i]
	count = 0
	for j in range(0, len(s), 1):
		if s[j] == '4' or s[j] == '7':
			count += 1
	if count <= k:
		temp += 1
print(temp)


(n, k) = map(int, input().split())
print(list(map(lambda x: x <= k, [str(i).count('4') + str(i).count('7') for i in list(map(int, input().split()))])).count(True))


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

def lcount(x):
	if x > 0:
		return lcount(int(x / 10)) + (1 if x % 10 == 4 or x % 10 == 7 else 0)
	else:
		return 0
inp = []
tot = 0

def solve(x):
	if x < n:
		global tot
		tot += 1 if lcount(int(inp[x])) <= k else 0
		solve(x + 1)
inp = input().split()
solve(0)
print(tot)


(n, k) = map(int, input().split())
a = input().split()
print(sum([i.count('4') + i.count('7') <= k for i in a]))


(n, k) = list(map(int, input().split()))
s = list(map(int, input().split()))
f = 0
for i in s:
	c = 0
	for j in str(i):
		if j in '74':
			c += 1
	if c <= k:
		f += 1
	c = 0
print(f)


s = [int(n) for n in input().split()]
z = [[int(k) for k in n] for n in input().split()]
l = 0
for n in range(s[0]):
	a = z[n].count(4)
	b = z[n].count(7)
	if a + b <= s[1]:
		l += 1
print(l)


x = input().split()
n = int(x[0])
k = int(x[1])
ans = 0
y = input().split()
for i in y:
	temp = i.count('4') + i.count('7')
	if temp <= k:
		ans += 1
print(ans)


def solve(a):
	count = 0
	while a != 0:
		temp = a % 10
		a = a // 10
		if temp == 4 or temp == 7:
			count += 1
	return count
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
count = 0
for i in arr:
	c = solve(i)
	if c <= k:
		count += 1
print(count)


(n, m) = map(int, input().split())
l = list(map(str, input().split()))
k = 0
for i in range(n):
	Z = l[i].count('4')
	Z1 = l[i].count('7')
	if Z1 + Z <= m:
		k = k + 1
print(k)


(x, y) = input().split()
(a, b, count1, list) = (int(x), int(y), 0, [int(x) for x in input().split()])
for i in list:
	count = 0
	while i > 0:
		d = i % 10
		if d == 4 or d == 7:
			count = count + 1
		i = int(i / 10)
	if count <= b:
		count1 = count1 + 1
print(count1)


(n, k) = map(int, input().split())
l = list(map(str, input().split()))
p = 0
for i in l:
	c = 0
	for j in i:
		if j == '4' or j == '7':
			c += 1
	if c <= k:
		p += 1
print(p)


import sys

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 lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans
mod = int(1000000000.0) + 7

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

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

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

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

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math as m
(n, k) = ninp()
a = llinp()
ans = 0
for i in a:
	x = str(i)
	cnt = 0
	for c in x:
		if c == '4' or c == '7':
			cnt += 1
	if cnt <= k:
		ans += 1
print(ans)


(n, k) = input().split()
(n, k) = (int(n), int(k))
li = list((int(num) for num in input().strip().split()))[:n]
cn = 0
for i in li:
	if i >= 1 and i <= 9:
		cn += 1
	elif str(i).count('4') + str(i).count('7') <= k:
		cn += 1
print(cn)


(n, k) = [int(x) for x in input().split()]
a = [x for x in input().split()]
print(len([1 for x in a if x.count('4') + x.count('7') <= k]))


(n, k) = [int(x) for x in input().split()]
x = [x for x in input().split()]

def lucky(item):
	count = 0
	for i in range(len(item)):
		if item[i] == '4' or item[i] == '7':
			count += 1
	return count
ans = 0
for item in x:
	if lucky(item) <= k:
		ans += 1
print(ans)


(n, k) = list(map(int, input().split()))
nar = input().split()
count = 0
for i in nar:
	count += 1
	c = 0
	for j in i:
		if j == '4' or j == '7':
			c += 1
			if c > k:
				count -= 1
				break
print(count)


(n, k) = [int(x) for x in input().split(' ')]
s = [i for i in input().split(' ')]
answer = 0
for i in s:
	if i.count('4') + i.count('7') <= k:
		answer += 1
print(answer)


(x, y) = map(int, input().split())
print(sum(list(map(lambda i: 1 if i.count('4') + i.count('7') <= y else 0, input().split()))))


(n, k) = map(int, input().split())
l1 = input().split()
countans = 0
for i in range(n):
	count1 = 0
	for j in l1[i]:
		if j == '7' or j == '4':
			count1 += 1
	if count1 <= k:
		countans += 1
print(countans)


(n, k) = map(int, input().split())
count = 0
s = list(input().split())
for i in range(n):
	temp = s[i]
	res = temp.count('4') + temp.count('7')
	if res > k:
		count += 1
print(n - count)


(n, k) = map(int, input().split())
counter = 0
arr = []
str1 = input()
arr = str1.split()
for i in range(n):
	if arr[i].count('4') + arr[i].count('7') <= k:
		counter = counter + 1
print(counter)


(n, k) = map(int, input().split())
aa = input()
aa = aa.split()
a = []
for i in aa:
	a.append(i)
c = 0
for i in a:
	if i.count('4') + i.count('7') <= k:
		c += 1
print(c)


(n, k) = map(int, input().split())
l = input().split()
for i in range(len(l)):
	a = l[i].count('4') + l[i].count('7')
	if a > k:
		n -= 1
print(n)


(n, k) = input().split(' ')

def calculate_magic(num):
	sum = 0
	num = list(num)
	for c in num:
		if c == '4' or c == '7':
			sum += 1
	return sum
sum = 0
all_nums = input().split(' ')
for i in range(int(n)):
	magics = calculate_magic(all_nums[i])
	if magics <= int(k):
		sum += 1
print(sum)


(n, k) = map(int, input().split())
p = input().split()
p = list(map(list, p))
c = 0
for i in range(n):
	q = p[i].count('4') + p[i].count('7')
	if q <= k:
		c += 1
print(c)


(n, k) = map(int, input().split())
ans = 0
for z in input().split():
	val = z.count('4') + z.count('7')
	if val <= k:
		ans += 1
print(ans)


(n, k) = [int(i) for i in input().split()]
data = [i for i in input().split()]
cnt = 0
for x in data:
	y = x.count('4') + x.count('7')
	if y <= k:
		cnt += 1
print(cnt)


[n, k] = [int(x) for x in input().split()]
l = [x for x in input().split()]
count = 0
for x in l:
	l_c = 0
	for y in x:
		if y == '4' or y == '7':
			l_c += 1
	if l_c <= k:
		count += 1
print(count)


def dig_count(number, k):
	tmp_count = 0
	for digit in number:
		if digit in ['4', '7']:
			tmp_count += 1
	if tmp_count > k:
		return False
	else:
		return True
(n, k) = map(int, input().split())
ls = list(map(str, input().split()))
ans = 0
for i in ls:
	tmp = dig_count(i, k)
	if tmp:
		ans += 1
print(ans)


k = int(input().split(' ')[1])
nums = input().split()
print(len(list(filter(lambda x: x.count('4') + x.count('7') <= k, nums))))


(n, m) = map(int, input().strip().split()[:2])
t = input().strip().split()[:n]
count = 0
for x in t:
	if x.count('7') + x.count('4') > m:
		count += 1
print(n - count)


(x, y) = map(int, input().split())
a = 0
c = list(input().split())
for i in range(len(c)):
	b = list(c[i])
	z = b.count('4') + b.count('7')
	if z <= y:
		a += 1
print(a)


def lucky(num):
	ans = 0
	for i in range(len(num)):
		if num[i] == '4' or num[i] == '7':
			ans += 1
	return ans
(n, k) = map(int, input().split())
ans = 0
arr = [x for x in input().split()]
for i in range(len(arr)):
	if lucky(arr[i]) <= k:
		ans += 1
print(ans)


(n, m) = map(int, input().split())
a = list(map(str, input().split()))
count = 0
for i in a:
	z = list(i)
	q = z.count('4')
	w = z.count('7')
	if q + w <= m:
		count += 1
print(count)


(n, k) = [int(i) for i in input().split()]
nums = input().split()
count = 0

def less_than_k(num, k):
	c = 0
	for d in num:
		if d in ['4', '7']:
			c += 1
		if c > k:
			return False
	return True
for num in nums:
	if less_than_k(num, k):
		count += 1
print(count)


l1 = [int(i) for i in input().split(' ')]
l2 = [j for j in input().split(' ')]
count = 0
for i in l2:
	if i.count('4') + i.count('7') <= l1[1]:
		count += 1
print(count)


def f(n, k):
	cnt = 0
	while n > 0:
		if n % 10 == 4 or n % 10 == 7:
			cnt += 1
		n //= 10
	if cnt <= k:
		return True
	return False
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for x in a:
	if f(x, k):
		ans += 1
print(ans)


import sys
input = sys.stdin.readline
(n, k) = [int(i) for i in input().split()]
a = [i for i in input().split()]
ans = 0
for i in a:
	if i.count('4') + i.count('7') <= k:
		ans += 1
print(ans)


(n, k) = [int(x) for x in input().split()]
l = [x for x in input().split()]
ans = 0
for x in l:
	if x.count('4') + x.count('7') <= k:
		ans += 1
print(ans)


(n, k) = list(map(int, input().split()))
print(sum((s.count('4') + s.count('7') <= k for s in input().split())))


(n, k) = [int(x) for x in input().split()]
a = [x for x in input().split()]
ans = 0
for i in range(n):
	c = a[i].count('4')
	c += a[i].count('7')
	if c <= k:
		ans += 1
print(ans)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
for i in l:
	k = 0
	for j in str(i):
		if j == '4' or j == '7':
			k += 1
	if k <= m:
		ans += 1
print(ans)


from math import *
import sys
from sys import *

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

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

def SL():
	return list(map(str, sys.stdin.readline().strip().split()))
t = stdin.readline
p = stdout.write
(n, k) = gI()
a = SL()
print(sum((sum((c in '47' for c in x)) <= k for x in a)))


(n, k) = map(int, input().split())
l = list(input().split())
count = 0
for i in l:
	a = i.count('4')
	b = i.count('7')
	if a + b > k:
		continue
	else:
		count = count + 1
print(count)


(n, k) = map(int, input().split())
a = list(input().split())
c = 0
for i in a:
	n4 = n7 = 0
	for j in i:
		if j == '4':
			n4 += 1
		elif j == '7':
			n7 += 1
	if n4 + n7 <= k:
		c += 1
print(c)


(_, k) = map(int, input().split())
print(sum((i.count('4') + i.count('7') <= k for i in input().split())))


(n, k) = list(map(int, input().split()))
a = input().split()
tmp = [len([1 for c in list(v) if c in ('4', '7')]) for v in a]
print(len([1 for _ in tmp if _ <= k]))


import math
import atexit
import io
import sys
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def array_to_string(a):
	s = ''
	for i in a:
		s += str(i)
	return s

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for i in a:
	num_str = str(i)
	four = num_str.count('4')
	seven = num_str.count('7')
	if four + seven > k:
		continue
	count += 1
print(count)


(a, b) = map(int, input().split())
print(sum((i.count('4') + i.count('7') <= b for i in input().split())))


line1 = input()
l1 = line1.split(' ')
(n, k) = (int(l1[0]), int(l1[1]))
line2 = input().split(' ')
answer = 0
for r in range(n):
	if line2[r].count('4') + line2[r].count('7') <= k:
		answer += 1
print(answer)


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 = LS()
	r = 0
	for c in a:
		t = 0
		for b in c:
			if b in '47':
				t += 1
		if t <= k:
			r += 1
	return r
print(main())


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
f = 0
d = 0
for i in a:
	f = 0
	j = i
	while j > 0:
		if j % 10 == 4 or j % 10 == 7:
			f = f + 1
		j = j // 10
	if f <= k:
		d = d + 1
print(d)


a = input()
a = a.split()
a1 = int(a[0])
a2 = int(a[1])
b = input()
b = b.split()
con = 0
for k in range(a1):
	d = b[k].count('7')
	e = b[k].count('4')
	z = d + e
	if z <= a2:
		con = con + 1
print(con)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for s in a:
	if str(s).count('4') + str(s).count('7') <= k:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for i in a:
	tem = 0
	for j in str(i):
		if j == '4' or j == '7':
			tem -= -1
	if tem <= k:
		ans -= -1
print(ans)


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 = inp().split()
	res = 0
	for i in arr:
		c = 0
		for j in i:
			if j in '47':
				c += 1
		if c <= k:
			res += 1
	print(res)

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()


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
a = 0
for i in range(len(l)):
	c = list(str(l[i]))
	s = 0
	for j in range(len(c)):
		if c[j] == '7' or c[j] == '4':
			s += 1
	if s <= k:
		a += 1
print(a)


(n, k) = [int(x) for x in input().split()]
nums = [int(x) for x in input().split()]
res = 0
for i in range(n):
	digits = list(str(nums[i]))
	l = len(digits)
	count = 0
	for j in range(l):
		if digits[j] == '4' or digits[j] == '7':
			count += 1
	if count <= k:
		res += 1
print(res)


data = input().split()
(N, K) = (int(data[0]), int(data[1]))
numbers = input().split()
answer = 0
for i in range(N):
	if numbers[i].count('4') + numbers[i].count('7') <= K:
		answer += 1
print(answer)


(n, k) = map(int, input().split())
ai = list(map(str, input().split()))
ans = 0
for i in range(n):
	num = ai[i].count('4') + ai[i].count('7')
	ans += num <= k
print(ans)


(n, k) = [int(s) for s in input().split(' ')]
a = input().split(' ')
print(len([y for y in [x.count('4') + x.count('7') for x in a] if y <= k]))


(n, k) = list(map(int, input().split()))
numbers = input().split()
result = 0
for each in numbers:
	num_lucky = 0
	for char in each:
		if char in ['4', '7']:
			num_lucky += 1
	if num_lucky <= k:
		result += 1
print(result)


(n, k) = [int(i) for i in input().split()]
res = 0
for num in input().split():
	count = 0
	for c in num:
		if c == '4' or c == '7':
			count += 1
	if count <= k:
		res += 1
	count = 0
print(res)


(n, a) = map(int, input().split())
l = list(input().split())
c = 0
for i in l:
	v = i.count('4')
	w = i.count('7')
	if v + w <= a:
		c = c + 1
print(c)


(n, k) = map(int, input().split())
li = list(map(int, input().split()))
cnt = 0
for data in li:
	s = str(data)
	if s.count('4') + s.count('7') <= k:
		cnt += 1
	else:
		pass
print(cnt)


T_ON = 0
DEBUG_ON = 1
MOD = 998244353

def solve():
	(n, k) = read_ints()
	A = input().split()

	def check(s, k):
		G = Counter(s)
		return G['4'] + G['7'] <= k
	count = 0
	for s in A:
		if check(s, k):
			count += 1
	print(count)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
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 read_int():
	return int(input())

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

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def fib_to_n(n):
	f = []
	(a, b) = (0, 1)
	while a <= n:
		f.append(a)
		(a, b) = (b, a + b)
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

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

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 == 1

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

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

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


i = lambda : input().split()
k = int(i()[1])
print(sum((sum((c in '47' for c in x)) <= k for x in i())))


(n, k) = map(int, input().split())
arr = list(map(str, input().split()))
s = 0
for i in arr:
	a = i.count('4')
	b = i.count('7')
	if a + b <= k:
		s += 1
print(s)


(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
count = 0
for i in range(0, len(a)):
	s = str(a[i])
	if s.count('4') + s.count('7') <= m:
		count = count + 1
print(count)


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

def get_cnt(a):
	sa = str(a)
	l = []
	tmp = 0
	for s in sa:
		if s == '4' or s == '7':
			tmp += 1
		else:
			if tmp != 0:
				l.append(tmp)
			tmp = 0
	if tmp != 0:
		l.append(tmp)
	return int(sum(l) <= k)
ans = 0
for a in A:
	ans += get_cnt(a)
print(ans)


(n, k) = input().split()
(n, k) = (int(n), int(k))
numbers = [str(x) for x in input().split()]
ans = 0
for x in numbers:
	if x.count('4') + x.count('7') <= k:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
L = [int(x) for x in input().split()]
ct = 0
for pp in L:
	c = 0
	p = int(pp)
	while p >= 1:
		if p % 10 == 4 or p % 10 == 7:
			c = c + 1
		p = int(p / 10)
	if c <= k:
		ct += 1
print(ct)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
no = 0
for x in range(n):
	count = 0
	while a[x] > 0:
		if a[x] % 10 == 4 or a[x] % 10 == 7:
			count += 1
		a[x] = int(a[x] / 10)
	if count <= k:
		no += 1
print(no)


nk = list(map(int, input().split()))
a = list(map(int, input().split()))
count = 0
temp = 0
for i in range(nk[0]):
	temp = 0
	if len(str(a[i])) < nk[1]:
		count += 1
	else:
		for j in range(len(str(a[i]))):
			if str(a[i])[j] == '4' or str(a[i])[j] == '7':
				temp += 1
			if temp > nk[1]:
				break
		if temp <= nk[1]:
			count += 1
print(count)


(n, i) = map(int, input().split(' '))
L = list(map(int, input().split(' ')))
cont2 = 0
for j in L:
	cont = 0
	n1 = str(j)
	for k in n1:
		if k == '4' or k == '7':
			cont += 1
	if cont <= i:
		cont2 += 1
print(cont2)


(n, k) = map(int, input().split())
ans = 0
for i in input().split():
	v = 0
	v = i.count('4', 0, len(i)) + i.count('7', 0, len(i))
	ans += int(v <= k)
print(ans)


import os
import sys
from io import BytesIO, IOBase
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')
readint = lambda : int(sys.stdin.readline().rstrip('\r\n'))
readints = lambda : map(int, sys.stdin.readline().rstrip('\r\n').split())
readstr = lambda : sys.stdin.readline().rstrip('\r\n')
readstrs = lambda : map(str, sys.stdin.readline().rstrip('\r\n').split())
readarri = lambda : [int(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
readarrs = lambda : [str(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]

def solve():
	(n, k) = readints()
	arr = readarri()
	ans = 0
	for i in arr:
		cnt = str(i).count('4')
		cnt += str(i).count('7')
		if cnt <= k:
			ans += 1
	print(ans)

def main():
	t = 1
	for _ in range(t):
		solve()
main()


(a, b) = map(int, input().split())
c = list(map(int, input().split()))
x = k = j = int(0)
while x < a:
	y = str(c[x])
	k = y.count('4') + y.count('7')
	if k <= b:
		j = j + 1
	x = x + 1
print(j)


def numLuckyDgits(num):
	count = 0
	while num:
		if num % 10 == 4 or num % 10 == 7:
			count += 1
		num //= 10
	return count

def solve(arr, n, k):
	result = 0
	for i in range(n):
		if numLuckyDgits(arr[i]) <= k:
			result += 1
	return result
(n, k) = list(map(int, input().strip().split()))
arr = list(map(int, input().strip().split()))
result = solve(arr, n, k)
print(result)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
lucky = ['4', '7']
for x in a:
	x_str = str(x)
	count = 0
	for digit in x_str:
		if digit in lucky:
			count += 1
			if count > k:
				break
	if count <= k:
		ans += 1
print(ans)


(n, m) = map(int, input().split())
a = list(input().split())
v = []
b = 0
for i in a:
	z = i.count('4') + i.count('7')
	v.append(z)
for j in v:
	if j <= m:
		b += 1
print(b)


def checkLucky(x):
	cnt = 0
	while x != 0:
		if x % 10 == 4 or x % 10 == 7:
			cnt += 1
		x = x // 10
	return cnt
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
cnt = 0
for i in arr:
	if checkLucky(i) <= k:
		cnt += 1
print(cnt)


(N, K) = [int(x) for x in input().split()]
T = input().split()
lucky = 0
for i in T:
	n = i.count('4') + i.count('7')
	if n > K:
		continue
	else:
		lucky += 1
else:
	print(lucky)


(n, k) = map(int, input().split())
count = 0
l = input().split()
for i in range(n):
	x = l[i].count('4')
	y = l[i].count('7')
	if x + y <= k:
		count += 1
print(count)


(n, k) = [int(i) for i in input().split()]
ans = 0
for s in input().split():
	if s.count('4') + s.count('7') <= k:
		ans += 1
print(ans)


(n, k) = list(map(int, input().split()))
a = list(input().split())
p = 0
for j in a:
	if '4' and '7' in j:
		if j.count('4') + j.count('7') <= k:
			p += 1
	elif '4' in j:
		if '7' not in j:
			if j.count('4') <= k:
				p += 1
	elif '7' in j:
		if '4' not in j:
			if j.count('7') <= k:
				p += 1
	else:
		p += 1
print(p)


count = 0
(n, k) = map(int, input().split())
L = list(map(str, input().split()))
for i in range(n):
	if L[i].count('4') + L[i].count('7') <= k:
		count += 1
print(count)


z = list(map(int, input().split()))
x = list(input().split())
c = 0
for i in x:
	a = i.count('7') + i.count('4')
	if a <= z[1]:
		c += 1
print(c)


(a, b) = map(int, input().split())
l = list(map(str, input().split()))
count = 0
for i in range(len(l)):
	if l[i].count('4') + l[i].count('7') <= b:
		count += 1
print(count)


(n, k) = map(int, input().split())
l = list(input().split())
ans = 0
for x in l:
	if len(x) <= k:
		ans += 1
	elif x.count('4') + x.count('7') <= k:
		ans += 1
print(ans)


class Test:
	pass

def cal(obj):
	Counter = 0
	for i in obj.l:
		for j in i:
			if j == '7' or j == '4':
				Counter += 1
		if Counter > obj.k:
			obj.n -= 1
		Counter = 0
	if Counter > obj.k:
		return True
	else:
		return False
obj = Test()
(obj.n, obj.k) = map(int, input().split())
obj.l = [*map(str, input().split())]
cal(obj)
print(obj.n)


(n, k) = map(int, input().split())
L = list(map(str, input().split()))
r = 0
for x in L:
	if x.count('4') + x.count('7') <= k:
		r += 1
print(r)


lim = [int(j) for j in input().split()]
numbers = input().split()
cases = 0
for i in numbers:
	lucky = i.count('4') + i.count('7')
	if lucky <= lim[1]:
		cases += 1
print(cases)


(n, k) = [int(x) for x in input().split(' ')]
a = [int(x) for x in input().split(' ')]
cnt = 0
for i in range(n):
	if str(a[i]).count('4') + str(a[i]).count('7') <= k:
		cnt += 1
print(cnt)


(n, k) = map(int, input().split())
a = [str(i) for i in input().split()]
x = 0
for i in a:
	h = 0
	for j in i:
		if j == '4' or j == '7':
			h += 1
		if h > k:
			break
	if h <= k:
		x += 1
print(x)


(N, K) = [int(i) for i in input().split()]
s = [i for i in input().split()]
t = 0
for elem in s:
	count = 0
	for j in range(len(elem)):
		if elem[j] == '4' or elem[j] == '7':
			count += 1
	if count <= K:
		t += 1
print(t)


(n, k) = [int(x) for x in input().split()]
l = [x for x in input().split()]
ss = ['4', '7']
co = 0
for p in l:
	if p.count('4') + p.count('7') <= k:
		co += 1
print(co)


import math

def luckDigits(x):
	count = 0
	while x != 0:
		if x % 10 == 4 or x % 10 == 7:
			count += 1
		x = x // 10
	return count

def main():
	(n, k) = input().split(' ')
	n = int(n)
	k = int(k)
	count = 0
	A = [int(x) for x in input().strip().split(' ')]
	for x in A:
		if luckDigits(x) <= k:
			count += 1
	print(count)
main()


(n, k) = [*map(int, input().split())]
a = [*map(int, input().split())]
print(sum((sum((c in '47' for c in str(x))) <= k for x in a)))


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
c = 0
for x in range(len(a)):
	d = str(a[x])
	c7 = d.count('7')
	c4 = d.count('4')
	if c4 + c7 <= k:
		c += 1
print(c)


params = input().split(' ')
numbers = input().split(' ')
gc = 0
for x in numbers:
	count = 0
	for y in x:
		if y == '4' or y == '7':
			count += 1
	if count <= int(params[1]):
		gc += 1
print(gc)


(n, k) = list(map(int, input().split()))
inp = input().split()
cntr = 0
for i in range(n):
	if inp[i].count('7') + inp[i].count('4') <= k:
		cntr += 1
print(cntr)


(n, k) = list(map(int, input().split()))
s = list(map(int, input().split()))
mc = 0
for i in range(n):
	f = {}
	c = 0
	t = str(s[i])
	for j in range(len(t)):
		if t[j] == '4' or t[j] == '7':
			c += 1
	if c >= 0 and c <= k:
		mc += 1
print(mc)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
k = 0
for i in a:
	s = 0
	for j in str(i):
		if j == '4' or j == '7':
			s = s + 1
	if s <= m:
		k = k + 1
print(k)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))[:n]
q = rem = 0
fc = len(a)
for i in range(n):
	c = 0
	rem = a[i]
	while rem != 0:
		q = rem % 10
		rem //= 10
		if q == 4 or q == 7:
			c += 1
	if c > m:
		fc -= 1
print(fc)


(n, k) = [int(x) for x in input().split()]
res = 0
for i in [int(x) for x in input().split()]:
	tmp = [int(x) for x in str(i)]
	if tmp.count(4) + tmp.count(7) <= k:
		res += 1
print(res)


(a, b) = map(int, input().split())
c = list(input().split())
d = 0
for i in c:
	if i.count('4') + i.count('7') <= b:
		d += 1
print(d)


(n, k) = list(map(int, input('').split()))
ar = list(map(int, input('').split()))
luck = '47'
cx = 0
for i in ar:
	l = list(str(i))
	count = 0
	for i in l:
		if i == '4' or i == '7':
			count = count + 1
	if count <= k:
		cx += 1
print(cx)


(n, k) = map(int, input().split())
print(sum((1 for number in input().split() if number.count('4') + number.count('7') <= k)))


temp = list(map(int, input().split()))
num = temp[0]
luck = temp[1]
check = 0
needed = 0
numbers = list(input().split())
for x in numbers:
	check = 0
	for y in x:
		if y == '4' or y == '7':
			check += 1
	if check <= luck:
		needed += 1
print(needed)


(n, k) = map(int, input().split())
f = 0
li = list(input().split())
for i in range(n):
	h = 0
	x = li[i]
	for j in x:
		if j == '4' or j == '7':
			h += 1
	if h <= k:
		f += 1
print(f)


def lucky(s):
	d = str(s)
	return len([v for v in d if v == '4']) + len([v for v in d if v == '7'])

def main():
	(n, m) = [int(v) for v in input().split()]
	vals = [int(v) for v in input().split()]
	print(len([v for v in vals if lucky(v) <= m]))
main()


def chck(a):
	b = 0
	for i in list(a):
		if i == '4' or i == '7':
			b += 1
	return b
(n, k) = map(int, input().split())
l = input().split()
c = 0
for i in l:
	if chck(i) <= k:
		c += 1
print(c)


import collections
(n, k) = map(int, input().split())
a = input().split()
ans = 0
for i in a:
	counter = collections.Counter(str(i))
	luck = 0
	for j in counter:
		if j == '4' or j == '7':
			luck = luck + counter[j]
	if luck <= k:
		ans = ans + 1
print(ans)


(n, k) = [int(x) for x in input().split()]
numbers = input().split()
result = 0
for number in numbers:
	count = 0
	for x in number:
		if x == '4' or x == '7':
			count += 1
	if count <= k:
		result += 1
print('%d' % result)


(a, b) = map(int, input().split())
l = list(map(str, input().split()))
c = 0
for i in l:
	if i.count('4') + i.count('7') <= b:
		c += 1
	else:
		continue
print(c)


(n, k) = [int(_) for _ in input().split()]
print(sum((_.count('7') + _.count('4') <= k for _ in input().split())))


(n, k) = input().split()
count = 0
for turns in input().split():
	p = 0
	for char in turns:
		if (char == '4') | (char == '7'):
			p = p + 1
	if p <= int(k):
		count = count + 1
print(count)


(x, k) = map(int, input().split())
l = list(map(str, input().split()))
c = 0
for i in range(len(l)):
	if l[i].count('4') + l[i].count('7') <= k:
		c = c + 1
print(c)


(n, k) = input().split()
(n, k) = (int(n), int(k))
l1 = [i for i in input().split()]
x = 0
for i in range(n):
	if len(l1[i]) == 1:
		x += 1
	elif l1[i].count('4') + l1[i].count('7') <= k:
		x += 1
print(x)


(n, k) = map(int, input().split())
a = input().split()
p = 0
q = 0
for i in range(n):
	for j in range(len(a[i])):
		if a[i][j] == '4' or a[i][j] == '7':
			p += 1
	if p <= k:
		q += 1
	p = 0
print(q)


s = input().split(' ')
n = int(s[0])
x = int(s[1])
s2 = input().split(' ')
t = []
for i in s2:
	t.append(i)
l = 0
p = 0
for i in t:
	for j in i:
		if j == '4' or j == '7':
			l += 1
	if l <= x:
		p += 1
		l = 0
	else:
		l = 0
print(p)


k = int(input().split(' ')[1])
nums = input().split(' ')
total = 0
for num in nums:
	if num.count('4') + num.count('7') <= k:
		total += 1
print(total)


(n, k) = input().split()
(n, k) = (int(n), int(k))
li = list((int(num) for num in input().strip().split()))[:n]
x = 0
for i in li:
	if 1 <= i < 10 or str(i).count('4') + str(i).count('7') <= k:
		x += 1
print(x)


n_k = list(map(int, input().split()))
numbers = list(map(int, input().split()))
output = 0
for i in range(len(numbers)):
	i_str = str(numbers[i])
	lucky = 0
	for j in range(len(i_str)):
		if i_str[j] == '4' or i_str[j] == '7':
			lucky += 1
	if lucky <= n_k[1]:
		output += 1
print(output)


(n, k) = map(int, input().split())
list1 = []
list1.append(list(map(int, input().split())))
list1 = list1[0]
ans = 0
for i in list1:
	c = str(i)
	count = 0
	for j in c:
		if j == '4' or j == '7':
			count += 1
	if count <= k:
		ans += 1
print(ans)


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()
ls = lambda : list(input().strip())
from collections import defaultdict as df
import heapq
infinite = float('inf')
(n, k) = RI()
l = RI()
c = 0
for i in range(n):
	temp = l[i]
	co = 0
	while temp:
		if temp % 10 == 7 or temp % 10 == 4:
			co += 1
		temp //= 10
	if co <= k:
		c += 1
print(c)


import sys
inf = float('inf')
(mod, MOD) = (1000000007, 998244353)

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

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

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

def check(n):
	c = 0
	for i in n:
		if i in ['4', '7']:
			c += 1
	if c <= k:
		return True
	return False
(n, k) = get_ints()
Arr = get_array()
count = 0
for i in Arr:
	if check(i):
		count += 1
print(count)


(n, m) = map(int, input().split())
s = input()
ara = s.split(' ')
ans = 0
for i in range(n):
	cnt = 0
	for j in range(len(ara[i])):
		if ara[i][j] == '4' or ara[i][j] == '7':
			cnt += 1
	if cnt <= m:
		ans += 1
print(ans)


from sys import stdin
(n, k) = map(int, stdin.readline().split())
l = stdin.readline().split()
ans = 0
for x in l:
	if x.count('4') + x.count('7') <= k:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
nums = list(map(str, input().split()))
total = 0
for n in nums:
	lucky = n.count('4') + n.count('7')
	if lucky <= k:
		total += 1
print(total)


x = 0
(n, k) = map(int, input().split(' '))
X = input().split(' ')
for i in range(n):
	count = 0
	for j in range(len(X[i])):
		if X[i][j] == '4' or X[i][j] == '7':
			count += 1
	if count <= k:
		x = x + 1
print(x)


from sys import stdin, stdout
from collections import deque
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
from random import randint
mod = 1000000007

def solve():
	(n, k) = mp()
	ans = 0
	l = input().split()
	for i in l:
		if i.count('4') + i.count('7') <= k:
			ans += 1
	pr(ans)
for _ in range(1):
	solve()


(n, x) = map(int, input().split())
l = []
count = 0
l = list(map(int, input().split()))
for i in range(0, n):
	c = 0
	f = 1
	s = l[i]
	while s > 0:
		r = int(s % 10)
		if r == 4 or r == 7:
			c = c + 1
		if c > x:
			f = 0
			break
		s = int(s / 10)
	if f == 1:
		count = count + 1
print(count)


class CodeforcesTask262ASolution:

	def __init__(self):
		self.result = ''
		self.n_k = []
		self.nums = []

	def read_input(self):
		self.n_k = [int(x) for x in input().split(' ')]
		self.nums = [int(x) for x in input().split(' ')]

	def process_task(self):
		r = 0
		for num in self.nums:
			if str(num).count('4') + str(num).count('7') <= self.n_k[1]:
				r += 1
		self.result = str(r)

	def get_result(self):
		return self.result
Solution = CodeforcesTask262ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


(a, b) = list(map(int, input().split()))
n = list(map(str, input().split()))
count = 0
for i in n:
	x = i.count('4')
	y = i.count('7')
	if x + y > b:
		count += 1
print(len(n) - count)


def nld(n):
	val = 0
	while n > 0:
		if n % 10 in (4, 7):
			val += 1
		n //= 10
	return val
(n, k) = (int(x) for x in input().split())
print(sum((1 for x in (int(x) for x in input().split()) if nld(x) <= k)))


(values, maxLucky) = map(int, input().split())
array = list(map(int, input().split()))
totalVals = 0
for i in range(0, values):
	counter = 0
	buffer = array[i]
	while buffer != 0:
		x = int(buffer) % 10
		if x == 4 or x == 7:
			counter += 1
		buffer /= 10
	if counter <= maxLucky:
		totalVals += 1
print(totalVals)


try:
	A = list(map(int, input().split()))
	n = A[0]
	k = A[1]
	total = 0
	ult = 0
	flag = 1
	B = list(map(str, input().split()))
	for i in B:
		total = 0
		flag = 1
		for j in i:
			if j == '4' or j == '7':
				total += 1
				if total > k:
					flag = 0
		if flag:
			ult += 1
	print(ult)
except:
	pass


def getLuckyCount(num):
	return len([i for i in num if i == '4' or i == '7'])
(n, k) = map(int, input().split(' '))
numbers = input().split(' ')
print(len([i for i in numbers if getLuckyCount(i) <= k]))


import sys
import math
from sys import stdin, stdout

def sieve(N):
	primeNumbers = [True] * (N + 1)
	primeNumbers[0] = False
	primeNumbers[1] = False
	i = 2
	while i * i <= N:
		j = i
		if primeNumbers[j]:
			while j * i <= N:
				primeNumbers[j * i] = False
				j += 1
		i += 1
	return primeNumbers

def getPrime(N):
	primes = sieve(N)
	result = []
	for i in range(len(primes)):
		if primes[i]:
			result.append(i)
	return result

def factor(N):
	factors = []
	i = 1
	while i * i <= N:
		if N % i == 0:
			factors.append(i)
			if i != N // i:
				factors.append(N // i)
		i += 1
	return sorted(factors)

def reduceB(b):
	mod = 0
	for i in range(0, len(b)):
		mod = (mod * 10 + ord(b[i])) % 1000000007
	return mod

def gcd(a, b):
	if a < b:
		return gcd(b, a)
	if b == 0:
		return a
	return gcd(b, a % b)

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

def get_int():
	return int(input())

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

def get_list_of_list(n):
	return [list(map(int, sys.stdin.readline().strip().split())) for _ in range(n)]

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

def main():
	(n, k) = get_ints_in_variables()
	arr = [str(i) for i in input().split()]
	res = 0
	for i in range(0, n):
		l = len(arr[i])
		count = 0
		for j in range(0, l):
			if arr[i][j] == '4' or arr[i][j] == '7':
				count += 1
		if count <= k:
			res += 1
	print(res)
main()


(n, k) = list(map(int, input().rstrip().split()))
a = list(map(int, input().rstrip().split()))
ans = 0
for i in a:
	count = 0
	while i > 0:
		d = i % 10
		i = i // 10
		if d == 4 or d == 7:
			count += 1
	if count <= k:
		ans += 1
print(ans)


def countLucky(number):
	count = 0
	temp = 0
	while number > 0:
		temp = number % 10
		if temp == 4 or temp == 7:
			count += 1
		number = int(number / 10)
	return count
count = 0
(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
for i in range(n):
	if countLucky(lst[i]) <= k:
		count += 1
print(count)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
arr = input().split()
ans = 0
for num in arr:
	if num.count('4') + num.count('7') <= k:
		ans += 1
print(ans)


n = list(map(int, input().split()))
A = list(map(int, input().split()))
count = 0
y = 0
for i in A:
	t = i
	while t != 0:
		x = t % 10
		if x == 4 or x == 7:
			y += 1
		t = t // 10
	if y <= n[1]:
		count += 1
	y = 0
print(count)


(n, k) = map(int, input().split())
l = '47'
arr = input().split()
count = 0
for i in arr:
	temp = 0
	for j in i:
		if j in l:
			temp += 1
	if temp <= k:
		count += 1
print(count)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
h = []
gk = 0
for i in l:
	s = str(i)
	cnt = 0
	for j in s:
		if j == '4' or j == '7':
			cnt += 1
	h.append(cnt)
for i in h:
	if i > k:
		gk += 1
print(n - gk)


(n, m) = [int(i) for i in input().split()]
l = input().split()
t = 0

def count(s):
	t = 0
	for i in s:
		if i == '4' or i == '7':
			t += 1
	return t
for i in range(n):
	if count(l[i]) <= m:
		t += 1
print(t)


def lucky_digits(num):
	count = 0
	for digit in str(num):
		if digit == '4' or digit == '7':
			count += 1
	return count
[n, k] = [int(x) for x in input().split()]
numbers = [int(x) for x in input().split()]
answer = 0
for number in numbers:
	if lucky_digits(number) <= k:
		answer += 1
print(answer)


import sys
import math

def fcount(val):
	count = 0
	for i in range(len(val)):
		if val[i] == '7' or val[i] == '4':
			count += 1
	return count
(n, k) = [int(x) for x in sys.stdin.readline().split()]
ai = list(sys.stdin.readline().split())
result = 0
for c in ai:
	if fcount(c) <= k:
		result += 1
print(result)


(n, k) = map(int, input().split())
ans = 0
ss = input().split()
for i in range(n):
	s = ss[i]
	add = 0
	for j in s:
		if j == '4' or j == '7':
			add += 1
	if add <= k:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
arr = list(map(str, input().split()))
count_ = 0
for i in arr:
	if i.count('4') + i.count('7') > k:
		continue
	else:
		count_ += 1
print(count_)


def check(n, k):
	s = str(n)
	c7 = s.count('7')
	c4 = s.count('4')
	if c4 + c7 > k:
		return False
	else:
		return True
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
for i in l:
	if check(i, k) == True:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
s = list(input().split())
r = 0
for i in range(n):
	q = 0
	for j in range(len(s[i])):
		if s[i][j] == '4' or s[i][j] == '7':
			q += 1
	if q <= k:
		r += 1
print(r)


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import Decimal
from decimal import *
from collections import defaultdict, deque
import heapq
from decimal import Decimal
getcontext().prec = 25
abcd = 'abcdefghijklmnopqrstuvwxyz'
ABCD = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
MOD = 1000000007
BUFSIZE = 8192
from bisect import bisect_left, bisect_right

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')
(n, k) = map(int, input().split(' '))
l = list(map(int, input().split(' ')))
ans = 0
for i in range(n):
	a = str(l[i]).count('4') + str(l[i]).count('7')
	if a <= k:
		ans += 1
print(ans)


(n, k) = input().split()
result = 0
num = input().split()
for x in num:
	if x.count('4') + x.count('7') <= int(k):
		result += 1
print(result)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
c = 0
for i in a:
	st = str(i)
	ct = st.count('4') + st.count('7')
	if ct <= k:
		c += 1
print(c)


a = 0
count = 0
(z, x) = [int(c) for c in input().split()]
v = list(map(str, input().split()))
for b in v:
	a += b.count('4')
	a += b.count('7')
	if a <= x:
		count += 1
	a = 0
print(count)


def count_lucky_numbers(l):
	counter = 0
	for i in range(len(l)):
		if l[i] == '4' or l[i] == '7':
			counter += 1
	return counter

def how_many_below(l, k):
	counter = 0
	for item in l:
		if count_lucky_numbers(item) <= k:
			counter += 1
	return counter

def main():
	first_line = input()
	first_line = first_line.split()
	n = int(first_line[0])
	k = int(first_line[1])
	l = input()
	l = l.split()
	print(how_many_below(l, k))
main()


s = input('')
(n, k) = s.split(' ')
n = int(n)
k = int(k)
l = []
s1 = input(' ')
s1 = s1.split(' ')
s1 = list(s1)
for i in s1:
	temp = i.count('4')
	temp1 = i.count('7')
	l.append([i, temp + temp1])
count = 0
for i in range(n):
	if l[i][1] <= k:
		count += 1
print(count)


lucky = [4, 7, 47, 744]

def check(n, k):
	c = 0
	while n != 0:
		r = n % 10
		if r in lucky:
			c += 1
		n = n // 10
	if c <= k:
		return True
	else:
		return False
(n, k) = map(int, input().split())
num = list(map(int, input().split()))
count = 0
for i in num:
	if check(i, k):
		count += 1
print(count)


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()
	ans = 0
	for x in l:
		a = str(x)
		c = 0
		for b in a:
			if b in ['4', '7']:
				c += 1
		if c <= k:
			ans += 1
	return ans
print(main())


X = list(map(int, input().split(' ')))
Numberlist = list(map(int, input().split(' ')))
Size = 0
for i in Numberlist:
	Y = list(map(int, str(i)))
	if Y.count(7) + Y.count(4) <= X[1]:
		Size += 1
print(str(Size))


(n, k) = map(int, input().split())
a = '4'
b = '7'
x = [1 if i.count('4') + i.count('7') <= k else 0 for i in input().split()]
print(x.count(1))


(t, k) = input().split(' ')
(t, k) = (int(t), int(k))
c = 0
l = input().split(' ')
for i in range(len(l)):
	n = l[i]
	if n.count('7') + n.count('4') <= k:
		c += 1
print(c)


def answer():
	a = input().split()
	k = int(a[1])
	a = input().split()
	c = []
	for x in a:
		b = list(x)
		temp = 0
		for x in b:
			if x == '4' or x == '7':
				temp += 1
		c.append(temp)
	c = [x for x in c if x <= k]
	print(len(c))
answer()


(n, k) = map(int, input().split())
v = input().split()
res = 0
for s in v:
	if s.count('4') + s.count('7') <= k:
		res += 1
print(res)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = list()
ans = 0
for item in a:
	j = str(item).count('7') + str(item).count('4')
	if j <= k:
		ans += 1
print(ans)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
count = 0
data = input().split(' ')
for i in data:
	t = i.count('4') + i.count('7')
	if t > k:
		count += 1
print(len(data) - count)


import sys
my_file = sys.stdin
line = my_file.readline().strip('\n').split()
(n, k) = (int(line[0]), int(line[1]))
a = my_file.readline().split()
count = 0
for i in a:
	if i.count('4') + i.count('7') <= k:
		count += 1
print(count)


import sys
import math
import bisect

def main():
	(n, k) = map(int, input().split())
	A = list(map(int, input().split()))
	ans = 0
	for a in A:
		cnt = 0
		for c in str(a):
			if c == '4' or c == '7':
				cnt += 1
		if cnt <= k:
			ans += 1
	print(ans)
main()


(n, k) = map(int, input().split())
array = list(map(int, input().split()))
d = 0
for i in array:
	if k >= str(i).count('4') + str(i).count('7'):
		d += 1
print(d)


(n, m) = list(map(int, input().split()))
l = input().split()
count1 = 0
count2 = 0
final = 0
for i in range(n):
	l1 = list(l[i])
	count1 = 0
	count2 = 0
	for j in range(len(l1)):
		if l1[j] == '4':
			count1 += 1
		elif l1[j] == '7':
			count2 += 1
	if count1 + count2 <= m:
		final += 1
print(final)


(n, k) = map(int, input().split())
l = input().split()
list1 = ['4', '7']
sum1 = 0
for i in l:
	count = 0
	for j in range(len(i)):
		if i[j] in list1:
			count += 1
	if count <= k:
		sum1 += 1
print(sum1)


(n, k) = map(int, input().split())
numbers = list(input().split())
(nLucky, counter) = (0, 0)
for i in range(n):
	for j in range(len(numbers[i])):
		if numbers[i][j] == '4' or numbers[i][j] == '7':
			nLucky += 1
			if nLucky > k:
				counter += 1
				break
	nLucky = 0
print(n - counter)


a = input().split()
n = int(a[0])
k = int(a[1])
x = n
a = input().split()
for i in a:
	z = 0
	for j in i:
		if j == '4' or j == '7':
			z += 1
	if z > k:
		x -= 1
print(x)


n = list(map(int, input().split()))
n1 = input().split()
s = 0
for i in n1:
	if i.count('4') + i.count('7') <= n[1]:
		s = s + 1
print(s)


(n, k) = [int(i) for i in input().split()]
a = [i for i in input().split()]
ctr = 0
for elem in a:
	if len(elem) <= k:
		ctr += 1
	elif elem.count('4') + elem.count('7') <= k:
		ctr += 1
print(ctr)


def main():
	(n, k) = map(int, input().split())
	a = list(input().split())
	total = 0
	for i in a:
		if i.count('4') + i.count('7') <= k:
			total += 1
	print(total)
main()


n = list(input().strip().split(' '))
numbers = list(input().strip().split(' '))
result = 0
for number in numbers:
	numb = str(number)
	if numb.count('4') + numb.count('7') <= int(n[1]):
		result += 1
print(result)


(n, k) = list(map(int, input().split()))
a1 = list(map(int, input().split()))
count = 0
for i in range(0, len(a1)):
	ele = str(a1[i])
	if ele.count('4') + ele.count('7') <= k:
		count += 1
print(count)


(n, k) = map(int, input().split())
nr = input().split()
lky = 0
for i in nr:
	if i.count('4') + i.count('7') <= k:
		lky += 1
print(lky)


(n, k) = map(int, input().split())
list1 = list(map(int, input().split()))
count = 0
for i in range(n):
	s = str(list1[i])
	x1 = s.count('7')
	x2 = s.count('4')
	x = x1 + x2
	if x <= k:
		count += 1
print(count)


(n, k) = map(int, input().split())
ans = 0
a = [str(i) for i in input().split()]
for i in range(len(a)):
	count47 = a[i].count('4') + a[i].count('7')
	if count47 <= k:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
q = list(map(str, input().split()))
ans = int(0)
for i in range(n):
	c = int(0)
	for j in range(len(q[i])):
		if q[i][j] == '4' or q[i][j] == '7':
			c += 1
		if c > k:
			break
	if c <= k:
		ans += 1
print(ans)


(n, k) = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
for i in x:
	if str(i).count('4') <= k and str(i).count('7') <= k and (str(i).count('4') + str(i).count('7') <= k):
		ans += 1
print(ans)