#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    int cnt[10];
    memset(cnt, 0, sizeof cnt);
    int c = 0;
    for (int j = 0; j < s.size(); j++) {
      cnt[s[j] - '0']++;
      if (cnt[s[j] - '0'] == 1 && (s[j] - '0') <= k) c++;
    }
    ans += c == (k + 1);
  }
  cout << ans << endl;
  return 0;
}
