#include <bits/stdc++.h>
using namespace std;
int check(int num, int k) {
  int arr[10] = {0};
  int d;
  while (num) {
    d = num % 10;
    arr[d]++;
    num /= 10;
  }
  for (int i = 0; i <= k; i++)
    if (arr[i] == 0) return 0;
  return 1;
}
int main(void) {
  int n, k, a, res = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a;
    res += check(a, k);
  }
  cout << res << endl;
  return 0;
}
