#include <bits/stdc++.h>
using namespace std;
int n, k;
char s[11];
int res = 0;
bool have[11];
int main() {
  scanf("%d%d\n", &n, &k);
  for (int i = 1; i <= n; ++i) {
    gets(s);
    int len = strlen(s);
    bool good = true;
    memset(have, false, sizeof have);
    for (int it = 0; it < len; ++it) have[s[it] - '0'] = true;
    for (int it = 0; it <= k; ++it) {
      if (!have[it]) {
        good = false;
        break;
      }
    }
    res += good;
  }
  printf("%d\n", res);
  return 0;
}
