#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t, k;
  cin >> t >> k;
  long long int count = 0;
  while (t--) {
    string s;
    cin >> s;
    map<long long int, long long int> m;
    for (long long int i = 0; i < s.size(); ++i) {
      m[s[i] - '0']++;
    }
    bool flag = true;
    for (long long int i = 0; i <= k; i++) {
      if (m.count(i) == 0) {
        flag = false;
      }
    }
    if (flag) {
      count++;
    }
  }
  cout << count << "\n";
}
