CF365A.Good Number

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Good Number

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 a**i without leading zeroes (1 ≤ a**i ≤ 109).

Output

Print a single integer — the number of k-good numbers in a.

Samples

10 6
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
1234560
10
2 1
1
10
1

在线编程 IDE

建议全屏模式获得最佳体验