#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    if (p + k > 5)
      continue;
    else
      v.push_back(p);
  }
  cout << v.size() / 3;
}
