#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  int s = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] + k <= 5) s++;
  }
  if (s >= 3)
    cout << s / 3;
  else
    cout << "0";
  return 0;
}
