#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, good_nr = 0;
  cin >> n >> k;
  string s;
  while (n--) {
    cin >> s;
    int arr[10] = {0};
    for (int i = 0; i < s.length(); i++) arr[s[i] - '0']++;
    good_nr++;
    for (int i = 0; i <= k; i++) {
      if (arr[i] == 0) {
        good_nr--;
        break;
      }
    }
  }
  cout << good_nr;
  return 0;
}
