#include <bits/stdc++.h>
using namespace std;
int a[109];
int main() {
  int n, m;
  while (cin >> n >> m) {
    for (int i = 0; i < n; i++) cin >> a[i];
    int p = 0;
    sort(a, a + n);
    for (int i = 0; i < n; i++) {
      int flag = 0;
      while (a[i]) {
        if (a[i] % 10 == 4 || a[i] % 10 == 7) flag++;
        a[i] /= 10;
      }
      if (flag <= m) p++;
    }
    cout << p << endl;
  }
}
