#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> s;
    bool ok = 1;
    map<int, bool> mark;
    for (int j = 0; j < s.size(); j++) {
      mark[s[j] - '0'] = 1;
    }
    for (int j = 0; j <= k; j++) {
      if (!mark[j]) {
        ok = 0;
        break;
      }
    }
    if (ok) cnt++;
  }
  cout << cnt;
}
