#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int num, count = 0;
  set<int> s;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= k; j++) s.insert(j);
    cin >> num;
    while (num != 0) {
      int r = num % 10;
      if (s.count(r)) s.erase(r);
      num /= 10;
    }
    if (s.empty()) count++;
    s.clear();
  }
  cout << count;
  return 0;
}
