#include <bits/stdc++.h>
using namespace std;
int n, k, x, l, w[111], ans;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    while (x) {
      w[x % 10] = 1;
      x /= 10;
    }
    for (int j = 0; j <= k; j++)
      if (!w[j]) l = 1;
    if (!l) ans++;
    for (int j = 0; j <= k; j++) w[j] = 0;
    l = 0;
  }
  cout << ans;
  return 0;
}
