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