#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int valu;
  int temp;
  cin >> n >> k;
  int count1 = 0;
  for (int i = 0; i < n; i++) {
    cin >> valu;
    int count2 = 0;
    while (valu) {
      temp = valu % 10;
      if (temp == 4 || temp == 7) count2++;
      valu /= 10;
    }
    if (count2 <= k) count1++;
  }
  cout << count1 << endl;
}
