import sys
_, k = map(int, input().strip().split())
count = 0
lines = sys.stdin.readlines()
for line in lines:
    line = line.strip()
    if not line:
        break
    s = sorted(list(set(map(int, line))))
    if len(s) >= k + 1 and s[k] == k:
        count += 1
print(count)

47bb6758b81b651e45db1fddb561fad7f9a1208f
<mask token>

<mask token>
for line in lines:
    line = line.strip()
    if not line:
        break
    s = sorted(list(set(map(int, line))))
    if len(s) >= k + 1 and s[k] == k:
        count += 1
print(count)

<mask token>
_, k = map(int, input().strip().split())
count = 0
lines = sys.stdin.readlines()
for line in lines:
    line = line.strip()
    if not line:
        break
    s = sorted(list(set(map(int, line))))
    if len(s) >= k + 1 and s[k] == k:
        count += 1
print(count)

import sys
_, k = map(int, input().strip().split())
count = 0
lines = sys.stdin.readlines()
for line in lines:
    line = line.strip()
    if not line:
        break
    s = sorted(list(set(map(int, line))))
    if len(s) >= k + 1 and s[k] == k:
        count += 1
print(count)
