#include <bits/stdc++.h>
using namespace std;
int n, k, a, ok, ans, occ[10];
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    int total = k + 1;
    memset(occ, 0, sizeof(occ));
    while (a) {
      if (!occ[a % 10] && (a % 10 <= k)) {
        total--;
      }
      occ[a % 10] = 1;
      a /= 10;
    }
    if (!total) {
      ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
