#include <bits/stdc++.h>
using namespace std;
long long int n, k, ans;
bool arr[10], ok;
string s;
int main(int argc, char** argv) {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> s;
    ok = true;
    for (int j = 0; j < 10; j++) {
      arr[j] = false;
    }
    for (int j = 0; j < s.length(); j++) {
      arr[s[j] - '0'] = true;
    }
    for (int j = 0; j <= k; j++) {
      if (!arr[j]) ok = false;
    }
    if (ok) ans++;
  }
  cout << ans;
  return 0;
}
