#include <bits/stdc++.h>
int main() {
  int n, k;
  std::cin >> n >> k;
  int count = 0;
  for (std::string s; std::cin >> s;) {
    std::unordered_set<int> xs;
    for (char c : s)
      if (c - '0' <= k) xs.insert(c);
    if (xs.size() == k + 1) ++count;
  }
  std::cout << count << '\n';
}
