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