#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, cnt = 0, cnts = 0;
  string s = "0123456789", s1;
  int ret = -1;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> s1;
    for (int j = 0; j <= k; j++) {
      ret = s1.find(s[j]);
      if (ret != -1) cnt++;
    }
    if (cnt == k + 1) {
      cnts++;
    }
    cnt = 0;
  }
  cout << cnts;
}
