#include <bits/stdc++.h>
using namespace std;
int n, k, a, b, c;
int main() {
  for (cin >> n >> k; n; n--) {
    cin >> a;
    b = 0;
    while (a) {
      if (a % 10 <= k) b = b | 1 << a % 10;
      a /= 10;
    }
    if (b + 1 == 1 << (k + 1)) c++;
  }
  cout << c << endl;
}
