#include <bits/stdc++.h>
using namespace std;
int n, m, a, k, i, j, t;
int arr[1000];
struct point2d {
  double x, y;
};
struct rectangle {
  point2d lower;
  point2d upper;
};
int main() {
  cin >> n >> k;
  string ss = "0123456789";
  string s;
  int ret = -1;
  int count1 = 0, count2 = 0;
  while (n--) {
    cin >> s;
    for (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 << "\n";
  return 0;
}
