#include <bits/stdc++.h>
using namespace std;
string arr[100];
int n, k;
int lucky(string s) {
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    s[i] == '7' || s[i] == '4' ? ++ans : ans;
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  scanf("%d", &k);
  for (int i = 0; i < n; i++) cin >> arr[i];
  int an = 0;
  for (int i = 0; i < n; i++) lucky(arr[i]) <= k ? an++ : an;
  cout << an;
  return 0;
}
