#include <bits/stdc++.h>
using namespace std;
int check(int num, int k) {
  int a[10] = {0}, i;
  i = 0;
  while (num > 0) {
    a[num % 10] = 1;
    num /= 10;
  }
  int flag = 0;
  for (i = 0; i < k + 1; i++) {
    if (a[i] == 0) flag = 1;
  }
  if (flag)
    return 0;
  else
    return 1;
}
int main() {
  int n, k, i, j;
  scanf("%d %d", &n, &k);
  int a[n], count = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    count += check(a[i], k);
  }
  cout << count << "\n";
  return 0;
}
