#include <bits/stdc++.h>
char L[11];
int k, l, n, ok, C[10];
int main() {
  scanf("%d %d", &n, &k);
  while (n--) {
    memset(C, 0, sizeof(C));
    scanf("%s", L);
    for (int i = 0; L[i]; i++) {
      C[L[i] - '0'] = 1;
    }
    ok = 1;
    for (int i = 0; i <= k; i++) {
      if (!C[i]) {
        ok = 0;
        break;
      }
    }
    if (ok) l++;
  }
  printf("%d\n", l);
  return 0;
}
