Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

A. Good Number

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputLet'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} ≤ 10^{9}).

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

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Mar/23/2017 03:20:25 (c2).

Desktop version, switch to mobile version.
User lists

Name |
---|