#include <bits/stdc++.h>
using namespace std;
int arr[11];
int main() {
  char no[100];
  int i, n, k, c, tcount, j;
  while (scanf("%d %d", &n, &k) == 2) {
    tcount = 0;
    for (i = 1; i <= n; i++) {
      scanf("%s", &no);
      c = 0;
      memset(arr, 0, sizeof(arr));
      for (j = 0; j < strlen(no); j++) {
        int x = no[j] - '0';
        if (x >= 0 && x <= k && arr[x] == 0) {
          c++;
          arr[x] = 1;
        }
      }
      if (c == k + 1) tcount++;
    }
    printf("%d\n", tcount);
  }
  return 0;
}
