#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int count = 0;
  int ncount = 0;
  int num[10000];
  for (int i = 0; i < n; i++) {
    cin >> num[i];
  }
  for (int i = 0; i < n; i++) {
    if (5 - num[i] >= k) {
      count++;
    }
    if (count == 3) {
      count = 0;
      ncount++;
    }
  }
  cout << ncount;
}
