#include <bits/stdc++.h>
using namespace std;
int main() {
  string number = "0123456789";
  int n, k, i, count = 0;
  cin >> n >> k;
  string a[n];
  number = number.substr(0, k + 1);
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sort(a[i].begin(), a[i].end());
    a[i].erase(unique(a[i].begin(), a[i].end()), a[i].end());
    if (a[i].substr(0, k + 1) == number) count++;
  }
  cout << count << endl;
}
