#include <bits/stdc++.h>
char arr[101];
bool vis[10];
int n, k;
int solve() {
  int i, tmp = 0;
  int cnt = 0;
  memset(vis, 0, sizeof(vis));
  for (i = 0; arr[i]; i++) {
    if (arr[i] - 48 <= k) vis[arr[i] - 48] = true;
  }
  for (i = 0; i < 10; i++) {
    if (vis[i]) cnt++;
  }
  return cnt == k + 1;
}
int main() {
  while (~scanf("%d%d", &n, &k)) {
    int i;
    int cnt = 0;
    for (i = 0; i < n; i++) {
      scanf("%s", arr);
      cnt += solve();
    }
    printf("%d\n", cnt);
  }
  return 0;
}
