import sys
import collections

n, k = map(int, sys.stdin.readline().split())
num = map(int, sys.stdin.readline().split())

c = 0
for x in num:
    s = str(x)
    if s.count('4') + s.count('7') <= k:
        c += 1
print c

18d64e3bf57681ecf9e0dab87c291190c997ba94
import sys
import collections

n, k = map(int, sys.stdin.readline().split())
num = map(int, sys.stdin.readline().split())

c = 0
for x in num:
    s = str(x)
    if s.count('4') + s.count('7') <= k:
        c += 1
print c
