#include <bits/stdc++.h>
using namespace std;
bool a[10];
int main() {
  int n, c = 0;
  int k;
  cin >> n >> k;
  while (n--) {
    memset(a, 0, sizeof a);
    string s;
    cin >> s;
    int l = s.length();
    bool f = 1;
    for (int i = 0; i < l; i++) a[s[i] - 48] = 1;
    for (int i = 0; i <= k; i++) {
      if (a[i] == 0) {
        f = 0;
      }
    }
    if (f) c++;
  }
  cout << c << endl;
  return 0;
}
