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