#include <bits/stdc++.h>
using namespace std;
int main() {
  int ara[10];
  int n, k, ct = 0;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    memset(ara, 0, sizeof(ara));
    int a;
    cin >> a;
    while (a > 0) {
      int b = a % 10;
      a /= 10;
      ara[b] = 1;
    }
    int f = 1;
    for (int i = 0; i <= k; i++)
      if (ara[i] == 0) {
        f = 0;
        break;
      }
    if (f) ct++;
  }
  cout << ct;
}
