#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, cnt1 = 0;
  cin >> n >> k;
  int y = k + 1;
  bool ab[y], a = false;
  for (int i = 0; i < y; i++) ab[i] = false;
  for (int i = 0; i < n; i++) {
    string x;
    cin >> x;
    for (int j = 0; j < x.length(); j++) {
      int h = x[j] - '0';
      ab[h] = true;
    }
    for (int l = 0; l < k + 1; l++)
      if (ab[l] == false) a = true;
    if (!a) {
      cnt1++;
    }
    if (a) a = false;
    fill(ab, ab + y, false);
  }
  cout << cnt1;
  return 0;
}
