#include <bits/stdc++.h>
int arr[110000];
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  int k;
  int cnt = 0;
  int cnt2 = 0;
  int num;
  cin >> n >> k;
  while (n--) {
    cin >> num;
    set<int> s;
    while (num) {
      if (num % 10 <= k) s.insert(num % 10);
      num /= 10;
    }
    if (s.size() == k + 1) cnt++;
  }
  cout << cnt;
}
