5888: 好数字

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:4 通过:3

题目描述


如果一个数字包含不超过 k (0,...,k) 的所有数字,则我们称它为 k-good。你有一个数字 k 和一个包含 n 个数字的数组 a。找出 a 中有多少个 k-good 数字(每次数组 a 中出现每个数字时都计算)。
Let's call a number k-good if it contains all digits not exceeding k (0,...,k). You've got a number k and an array a containing n numbers. Find out how many k-good numbers are in a (count each number every time it occurs in array a).
Input
The first line contains integers n and k (1≤n≤100, 0≤k≤9). The i-th of the following n lines contains integer ai without leading zeroes (1≤ai≤109).
Output
Print a single integer − the number of k-good numbers in a.
Examples
Input
10 6
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
Output
10
Input
2 1
1
10
Output
1 

输入格式

第一行包含整数 n 和 k (1≤n≤100, 0≤k≤9)。以下 n 行的第 i 行包含不带前导零 (1≤ai≤109) 的整数 ai。

输出格式

打印单个整数 − a 中 k 个好数。
例子
输入
10 6
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
输出
10
输入
2 1
1
10
输出
1

输入样例 复制

10 6
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560

输出样例 复制

10