#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, ans = 0;
  cin >> n >> k;
  string s, comp;
  for (int i = 0; i <= k; i++) {
    comp[i] = i + '0';
  }
  for (int i = 0; i < n; i++) {
    cin >> s;
    sort(s.begin(), s.end());
    int x = 0, y = 0;
    for (; x < (int)s.size() && y < k + 1; x++) {
      if (s[x] == comp[y]) {
        y++;
      }
    }
    if (y == k + 1) ans++;
  }
  cout << ans << endl;
}
