#include <bits/stdc++.h>
using namespace std;
int n, m, a, b;
string s;
int main() {
  cin >> n >> m;
  while (n--) {
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == '4' or s[i] == '7') a++;
    }
    if (a <= m) b++;
    a = 0;
  }
  cout << b;
}
