#include <bits/stdc++.h>
using namespace std;
long long z, mn, mx, sum, ans, k, pos, pos1, r, xx, yy, zz, n, m, x, y;
vector<int> v;
bool OK[1000002], KO[1000002], zoom;
int b[100003], c[100002];
map<char, int> mp, mr;
set<int> st;
int main() {
  string s;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
      if (s[i] == '7' || s[i] == '4') ++ans;
    }
    if (ans <= k) ++sum;
    ans = 0;
  }
  cout << sum;
}
