#include <bits/stdc++.h>
using namespace std;
int arr[100005];
bool is[10];
int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    for (int j = 0; j <= k; j++) is[j] = false;
    while (arr[i]) {
      is[arr[i] % 10] = true;
      arr[i] /= 10;
    }
    for (int j = 0; j <= k; j++) {
      if (!is[j]) break;
      if (j == k) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
