#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  vector<int> v;
  cin >> n >> k;
  while (n--) {
    int temp;
    cin >> temp;
    v.push_back(temp);
  }
  for (int i = 0; i < v.size(); i++) {
    if (v[i] + k > 5) v[i] = 10;
  }
  sort(v.begin(), v.end());
  v.push_back(100);
  int cntr = 0;
  for (int i = 0; i < v.size(); i += 3) {
    if (v[i] < 10 && v[i + 2] < 10 && v[i + 2] != 100) cntr++;
  }
  cout << cntr << endl;
}
