#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, x, count, total = 0;
  string s, str = "0123456789";
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    count = 0;
    cin >> s;
    x = s.size();
    for (int j = 0; j <= k; j++) {
      for (int m = 0; m < x; m++) {
        if (str[j] == s[m]) {
          count++;
          break;
        }
      }
    }
    if (count == k + 1) total++;
  }
  cout << total;
}
