#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  string x;
  int A[k];
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    int check = 0;
    int Mcheck = 1;
    for (int i = 0; i <= k; i++) {
      for (int j = 0; j < x.length(); j++) {
        if ((x[j] - 48) == i) {
          check = 1;
          break;
        }
      }
      if (check == 0) {
        Mcheck = 0;
      }
      check = 0;
    }
    if (Mcheck == 1) {
      ++sum;
    }
    Mcheck = 1;
  }
  cout << sum << endl;
  return 0;
}
