#include <bits/stdc++.h>
using namespace std;
int check(long long n, int k) {
  if (n == 0 && k == 0) return 1;
  int a;
  int* b = new int[10];
  for (int i = 0; i < 10; i++) b[i] = 0;
  while (n != 0) {
    a = n % 10;
    b[a]++;
    n = n / 10;
  }
  for (int i = 0; i <= k; i++) {
    if (b[i] == 0) return 0;
  }
  return 1;
}
int main() {
  int n, k;
  cin >> n >> k;
  long long* arr = new long long[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    count += check(arr[i], k);
  }
  cout << count;
  return 0;
}
