#include <bits/stdc++.h>
using namespace std;
int M[10];
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int n, i, j, k, x, y, c = 0;
  cin >> n >> k;
  while (n--) {
    cin >> x;
    memset(M, 0, sizeof(M));
    while (x) M[x % 10] = 1, x /= 10;
    c++;
    for (i = 0; i <= k; ++i) {
      if (M[i] == 0) {
        c--;
        break;
      }
    }
  }
  cout << c << endl;
  return 0;
}
