#include <bits/stdc++.h>
using namespace std;
bool isGood(string num, int k) {
  int was[10] = {0};
  for (int i = 0; i < num.size(); i++) {
    was[num[i] - '0'] = 1;
  }
  for (int i = 0; i <= k; i++)
    if (was[i] == 0) return false;
  return true;
}
int n, k, ans;
string temp;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    if (isGood(temp, k)) ans++;
  }
  cout << ans;
  return 0;
}
