#include <bits/stdc++.h>
using namespace std;
map<char, int> count1;
string str, s, s1;
int main() {
  int n, sum = 0, k;
  cin >> n >> k;
  for (int j = 0; j <= k; j++) s.push_back(j + '0');
  for (int i = 0; i < n; i++) {
    cin >> str;
    count1.clear();
    int limit = k + '0', tr = 1;
    for (int j = 0; j < str.size(); j++) {
      char ch = str[j];
      if (ch < '0' || ch > limit + '0') {
        tr = 0;
        break;
      }
      count1[ch] += 1;
    }
    if (tr) {
      for (int i = 0; i <= k; i++) {
        if (count1[i + '0'] == 0) {
          tr = 0;
          break;
        }
      }
      if (tr) sum += 1;
    }
  }
  cout << sum << endl;
}
