#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return (a / g) * b;
}
int main() {
  int n, k;
  int c = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    map<int, int> m;
    do {
      if (tmp % 10 <= k) m[tmp % 10] = 1;
      tmp /= 10;
    } while (tmp);
    if (m.size() == k + 1) {
      c++;
    }
  }
  cout << c << endl;
  return 0;
}
