#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int m = n;
  string nums;
  for (int i = 0; i < n; i++) {
    cin >> nums;
    char car = '0';
    int w = 0;
    for (int x = 0; x <= k; x++) {
      int plc = nums.find(car);
      if (plc >= 0) {
        w++;
        car++;
      }
    }
    if (w <= k) {
      m--;
    }
  }
  cout << m << endl;
  return 0;
}
