#include <bits/stdc++.h>
using namespace std;
int n, k, c = 0;
int main() {
  scanf("%d%d", &n, &k);
  while (n--) {
    int d[10], u;
    fill(d, d + 10, 0);
    scanf("%d", &u);
    while (u > 0) {
      ++d[u % 10];
      u /= 10;
    }
    bool ok = 1;
    for (int i = k; i >= 0; --i) {
      if (d[i] == 0) ok = 0;
    }
    c += (ok);
  }
  printf("%d", c);
}
