#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
int N, K;
int ans;
string s;
bool validate() {
  bool arr[10];
  memset(arr, false, sizeof(arr));
  int len = s.length();
  for (int i = 0; i != len; i++) arr[s[i] - '0'] = true;
  for (int i = 0; i <= K; i++) {
    if (!arr[i]) return false;
  }
  return true;
}
int main(int argc, char** argv) {
  cin >> N >> K;
  while (N--) {
    cin >> s;
    ans += validate();
  }
  printf("%d\n", ans);
  return 0;
}
