#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string str;
  int k;
  int ans = 0;
  cin >> n >> k;
  for (int i = 0; i < (n); i++) {
    int check = 0;
    bool used[10] = {0};
    cin >> str;
    for (int j = 0; j < (str.size()); j++) {
      used[str[j] - '0'] = true;
    }
    for (int j = 0; j < (k + 1); j++) {
      check += used[j] == 1;
    }
    if (check == k + 1) ans++;
  }
  cout << ans << endl;
  return 0;
}
