#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int n, k;
  cin >> n >> k;
  int good = 0;
  for (int i = 0; i < n; i++) {
    int v;
    cin >> v;
    if (v + k <= 5) good++;
  }
  cout << good / 3 << endl;
  return 0;
}
