#include <bits/stdc++.h>
using namespace std;
int dr[4] = {1, -1, 0, 0};
int dc[4] = {0, 0, 1, -1};
vector<int> g;
int main() {
  int n, c1 = 0, c2 = 0, k;
  cin >> n >> k;
  g.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> g[i];
  }
  sort(g.begin(), g.end());
  for (int i = 0; i < n; i++) {
    if ((g[i] + k) <= 5) {
      c1++;
      if (c1 == 3) {
        c2++;
        c1 = 0;
      }
    }
  }
  cout << c2;
  return 0;
}
